Friday Perl Challenge

Joel Bernstein joel at fysh.org
Fri Apr 20 10:25:27 BST 2007


On Fri, Apr 20, 2007 at 10:13:24AM +0100, Joel Bernstein wrote:
> perl -nle 'map{$X{$_}++}split/\s+/}{print"$_:$X{$_}"for sort keys%X'

perl -F/\s+/ -anle '$X{$_}++for at X}{print"$_:$X{$_}"for sort keys %X'
uses -a (autosplit) but is only slightly golfier.

/joel


More information about the london.pm mailing list