but I wanted to ask, does this code check also if any key of hash2 is in hash1? Or must I write it again so as to get the keys of hash2 that are present in hash1?my @common = (); foreach (keys %hash1) { push(@common, $_) if exists $hash2{$_}; } # @common now contains common keys
In reply to common keys in two hashes by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |