my %counts; while (my $key = shift @out) { $counts{$key} += shift @out1; } #### print "$_: \t$counts{$_}\n" for sort keys %counts;