in reply to Comparing two hashes for duplicate keys with no case sensitivity
use strict; use warnings; my %hash1 = ("TEXT", 25); my %hash2 = ("text", 25); my %hash1a; for (keys %hash1) { $hash1a{lc $_} = $hash1{$_} } for (keys %hash2) { if (exists $hash1a{lc $_}) { print "matches\n";} }
prints:
matches
Update: This will work even if the keys are mixed case: teXT. If the keys are all upper case or all lower case, then FunkyMonk's solution is simpler
|
|---|