How's this:
use List::Util 'sum'; my %collect; for my $i ( 0 .. $#@sequences ) { push @{ $collect{ $sequences[ $i ] } }, $numbers[ $i ]; } for my $sequence ( keys %collect ) { my $avg = ( sum @{$collect{$sequence}} )/@{$collect{$sequence}}; printf "sequence: $sequence = %.1f\n", $avg; }
the lowliest monk
In reply to Re: finding matches in the same array
by tlm
in thread finding matches in the same array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |