foreach $item1 (keys(%hash1)) { foreach $item2 (keys(%hash2)) { if (exists $hash1{$item2}) { print "matches\n";} } }
This code is a bit confusing because you don't use $item1 at all. If you have two nested loops anyway, you don't need exists and can simply compare lc($item1) eq lc($item2).
In reply to Re: Comparing two hashes for duplicate keys with no case sensitivity
by betterworld
in thread Comparing two hashes for duplicate keys with no case sensitivity
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |