in reply to finding matches in the same array
my @sequence = ('actg','actg','cggt','cggt'); my @numbers = ('1234','2345','3244','3455'); my (%total, %count, $i); for ($i=0; $i<@sequence; $i++) { $total{$sequence[$i]}+=$numbers[$i]; $count{$sequence[$i]}++; } for (sort keys %total) { my $avg=$total{$_}/$count{$_}; print "$_ avg: $avg\n"; }
|
|---|