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


in reply to Re: Golf: Count unique words
in thread Golf: Count unique words

73 (70 + 3 for the switches). The \b's are pretty much unnecessary and using $& means you don't need parens.

#!/usr/bin/perl -nl END{print map("$_ ($w{$_})\n",sort keys%w),$t}s/\w+/$w{$&}++;$t++/eg;