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


in reply to Top five words by occurrence

To select only words you can use \W+ (see perlre non-words):

... my @words = split /\W+/; ...

For show only first 5 occurs you can use this syntax:

foreach $w ( ( sort { $count{$b} <=> $count{$a} } keys %count ) [0..4] ) { ... }
.............

--
Marco Antonio
Rio-PM