Friday Perl Challenge

Joel Bernstein joel at fysh.org
Fri Apr 20 13:04:54 BST 2007


On Fri, Apr 20, 2007 at 01:19:57PM +0200, Luis Motta Campos wrote:
>   Do I win extra points for using a /e regexp? :-)

Yes, but you lose them again for using $&...

> perl -nle 's{\S+}{$w{$&}++;}eg}{print"$_,$w{$_}"for sort keys%w'

Your ; inside the s{}{} is superfluous

/joel


More information about the london.pm mailing list