[MPlayer-dev-eng] Quiz

Jonas Fällman tarpan at acc.umu.se
Thu Nov 6 10:36:50 CET 2003


Hello.

Why a so long and strange code (such as split:ing @_ to @_) when it can
be done shorter (and probably a lot shorter than this one also):

sub A{my($i)=@_;$i if(length($i)<4);@c=();while($i=~s/(.)//){$c[++$#c]=
$1};for($i=0;$i<=($#c*20);$i++){$a=int(rand($#c)+1);$b=int(rand($#c)+1
);next if $a==$b;$t=$c[$a];$c[$a]=$c[$b];$c[$b]=$t};return join("", at c)
};while(<>){chomp();$z="";s/\b(\w)(\w*?)(\w)\b/sprintf("%s%s%s",$1,
A($2),$3)/eg;print"$_\n"}

/tarp

(ps. yes I'm highly aware of how offtopic this is ;) )



More information about the MPlayer-dev-eng mailing list