in reply to Array Question
There are two problems here:
1) count the occurance of words
2) display the words and occurances in decending order.
Try this...
1) count the occurance of words
2) display the words and occurances in decending order.
Try this...
my %count; for (@letters) { $count{$_}++; } for ( map { $_->[0] } sort { $b->[1] <=> $a->[1] } map { [ $_, $count{$_} ] } keys %count ) { print $_, "=>", $count{$_}, "\n"; }
In Section
Seekers of Perl Wisdom