in reply to Need advice on checking two hashes values and keys
Uh... you iterate over the file while (<$in1>){ but inside that loop you iterate AGAIN? over foreach my $key (sort keys %hash){
That does not make much sense. A hash is made such that you do not need to iterate over them. You are treating the hash like it was an array.
while (<$in1>){ chomp; my ($key,$value) = split (/\s*=\s/); if (exists $hash{$key}){ print $out "$key => $hash{$key}, $value \n"; }else{ print $out1 "$key => $value \n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Need advice on checking two hashes values and keys
by perlynewby (Scribe) on Jun 03, 2015 at 22:43 UTC | |
by perlynewby (Scribe) on Jun 03, 2015 at 23:12 UTC |