1 2 3 4 5 6 7 8 9
while (<>) { for (split(/\W+/)) { $freq{$_}++; } } for (sort keys %freq) { print "$_ -- $freq{$_}\n"; }