avidcoder has asked for the wisdom of the Perl Monks concerning the following question:

I have 2 hashes and I am comparing both the hashes. First I check if the Key from hash2 exists in the hash1 and then compare the values. So the question is how do I ignore case when comparing the Hash keys in the below example code.
#! /usr/bin/perl # %hash1 = ("John", 43, "Paul", 25, "Marie", 22); %hash2 = ("john", 43, "Paul", 25, "marie", 22); while (($KEY_2, $VALUE_2) = each %hash2){ if (exists $hash1{$KEY_2}){ print "$KEY_2 : Matched\n"; } else{ print "$KEY_2 : Did not match\n"; } }
In the above example, John does not match with john as keys have different case. How do I ignore case when comparing the keys in the above example?
Here is the output of the script when you run it john : Did not match Paul : Matched marie : Did not match
Your help is much appreciated.