Friday Perl Challenge

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


--- Joel Bernstein <joel at fysh.org> 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%::_'

Cheers,
Ovid

--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/


More information about the london.pm mailing list