http://www.perlmonks.org?node_id=411197

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I'm pretty new to perl (hmm, maybe the obfuscated section isn't the best place for beginners...) and really love the regexs and the fact so little code can do so much. So I was particularly impressed when my first attempt at a small but nearly useful program worked (esp for Bram Stokers Dracula in 1.6 seconds):

   s/\b(\w+)\b/$w{$1}++;$t++;$1;/eg while (<>);
   print "$_ ($w{$_})\n" for (sort keys %w);
   print "\n$t\n";

Having seen how fast it works, and how small it is, I started wondering if it could be made any smaller. Not necessarily obfuscated, but just compacted a bit.

So, can it?