Friday Perl Challenge

Luis Motta Campos luismottacampos at yahoo.co.uk
Fri Apr 20 13:11:23 BST 2007


On Apr 20, 2007, at 1:19 PM, Luis Motta Campos wrote:
>   Do I win extra points for using a /e regexp? :-)
>
> perl -nle 's{\S+}{$w{$&}++;}eg}{print"$_,$w{$_}"for sort keys%w'

   And for additional pretty printing? :-)

perl -MData::Dumper -nle 's/\S+/$w{$&}++/eg}{print Dumper\%w'

--
Luis Motta Campos (a.k.a. Monsieur Champs) is a software engineer,
Perl fanatic evangelist, and amateur {cook, photographer}




More information about the london.pm mailing list