I think you want something like this:
--my %freq; $freq{$_}++ for @items; foreach (sort { $freq{$b} <=> $freq{$a} } keys %freq) { print "$_ : $freq{$_}\n"; }
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: calculating frequency of item in an array
by davorg
in thread calculating frequency of item in an array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |