foreach my $word (keys %{$counting{word}}) { print "$word\t", min ($counting{word}{$word}{str1}, $counting{word}{$word}{str2}) }