my @array = ('foo', 'foo', 'bar', 'foo', 'bar', 'baz'); my %count; $count{$_}++ for @array; for(sort(keys(%count))) { print "$_: $count{$_}\n"; }
I'm sure you can work out how to then calculate the percentages.
In reply to Re: Array statistics
by mfriedman
in thread Array statistics
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |