in reply to Comparing two hashes for duplicate keys with no case sensitivity

Use uc or lc to force the keys to upper or lower case. Here's an example using uc:

my %hash1 = ("TEXT", 25); my %hash2 = ("text", 25); foreach my $item2 (keys(%hash2)) { if (exists $hash1{uc $item2}) { print "matches\n";} }

In real code, I'd probably be changing the keys as I inserted them into the hash (if possible):

$hash1{lc $item1} = $value1; # etc

Update:

PS You don't need the outer loop you had in your original code. You'll notice you don't use $item1 anywhere.


Unless I state otherwise, all my code runs with strict and warnings