in reply to hash to hash comparison on large files
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:
exhausts the <FH1> iterator for the first value in @allhits, and does nothing for the subsequent values - probably not what you want.foreach(@allhits){ while(my $str=<FH1>){
Likewise I don't see how you ever get items into @file2. (Update: I should have looked more carefully)
|
|---|