in reply to hash to hash comparison on large files

You're only iterating over hashes, not using the lookup features. If you do it properly, you'll increase the speed of the loop roughly by the number of elements in %hash2.
while(my ($key1,$value1)=each(%hash1)){ while(my ($key2,$value2)=each(%hash2)){ if($key1 eq $key2){ ... } }

Should be better (and faster!) written as

while(my ($key1,$value1)=each(%hash1)){ if (exists $hash2{$key} ) { my $value2 = $hash2{$key} ... } }

Also note that this code:

foreach(@allhits){ while(my $str=<FH1>){
exhausts the <FH1> iterator for the first value in @allhits, and does nothing for the subsequent values - probably not what you want.

Likewise I don't see how you ever get items into @file2. (Update: I should have looked more carefully)