Friday Perl Challenge

Eric Wilhelm scratchcomputing at
Fri Apr 20 18:49:18 BST 2007

# from Joel Bernstein
# on Friday 20 April 2007 02:13 am:

>perl -nle 'map{$X{$_}++}split/\s+/}{print"$_:$X{$_}"for sort keys%X'


I decided to go OO, which means I totally bomb the #2, but I
should still get my #3 bonus because he didn't say anything about

 export PERL5OPT='-Mlist=L,F'
 perl -ln0e 'print for L(split)->map(F{$X{$_}++?():$_})->sort->map(F{"$_:$X{$_}"})->l'

Too bad about the counting though.  I guess needs
something for that.


"You can't win. You can't break even. You can't quit."
--Ginsberg's Restatement of the Three Laws of Thermodynamics

More information about the mailing list