Friday Perl Challenge

Ovid publiustemp-londonpm at
Fri Apr 20 10:45:13 BST 2007

--- Joel Bernstein <joel at> wrote:

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

Isn't the /\s+/ superfluous?

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

Though sometimes I don't mind ungolfing just to screw around a bit:

  perl -nle 'map{$::_{$_}++}split}{print"$_:$::_{$_}"for sort keys%::_'



Buy the book --
Perl and CGI --

More information about the mailing list