I remember having a similar problem posed as a fun challenge on
another forum. The challenge was to extract word counts and print them sorted by frequency, using the fewest lines of code. Naturally, Perl won that one by a mile. This was the solution that was proposed (called by `perl script.pl < filename.txt'). It's ugly as hell but it's fun!
print "$_ = $count{$_}\n" for sort { $count{$b} <=> $count{$a} } grep
+/\w/, map { lc $_ if (!$count{lc $_}++) } split( /[\W_]/ , join (' '
+, <>));