my @data = &initialize_it_the_way_you_want() ; my $total = @data ; # or scalar @data, explicitly die "give me arguments!" unless $total ; my %count ; my %perc ; map $count{$_}++,@data ; map { $perc{$_} = $count{$_}/$total } keys %count ; # Now you have recurrence counts on %count and # percentages on %perc to do whatever you want.
Ciao!
--bronto
# Another Perl edition of a song:
# The End, by The Beatles
END {
$you->take($love) eq $you->made($love) ;
}
In reply to Re: Array statistics
by bronto
in thread Array statistics
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |