Re: Phalanx top 100 CPAN modules golf

Rick Klement <[email protected]>
Newsgroups gmane.comp.lang.perl.fun
Message-ID <[email protected]>
Andrew Savige wrote:
> 
> Replacing the grotty sprintf with pack saves 4 strokes:
> 
> #!perl -lp
> / /;$A{pack A10,$'}.=$".$`}for(map{s}.}9-$&}e;$_}sort
> map{9-$A{$_}=~y. ..." $_:$A{$_}"}keys%A){

And replacing one map with a sort, taking advantage of the fact that
in 5.8, sort is stable, saves 10 strokes:

#!perl -lp
/ /;$a{pack A10,$'}.=" $`"}for(sort{$b-$a}map$a{$_}=~y/ //." $_:$a{$_}",sort
keys a){

P.S. Ever wonder what yours is going to do when someone has more than
nine modules ?

-- 
Rick Klement
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.