Re: Phalanx top 100 CPAN modules golf

Andrew Savige <[email protected]>
Newsgroups gmane.comp.lang.perl.fun
Message-ID <[email protected]>
> #!perl -lp
> / /;$A{$'}.=$".$`}for(map{s}.}9-$&}e;$_}sort
> map{9-$A{$_}=~y. ...sprintf" %-10s:$A{$_}",$_}keys%A){

Interesting sub-problem is shortest way to space-fill the CPAN ID:
  sprintf"%-10s",$_
  pack A10,$_
  uc($_^$"x10)
The last works because CPAN IDs match /^[A-Z]{4,9}$/.

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){

/-\



http://search.yahoo.com.au - Yahoo! Search
- Looking for more? Try the new Yahoo! Search
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.