# this code creates an endless loop my %hash = ( foo=>"x", Foo=>"y", Bar=>"a", bar=>"c" ); while(my($key,$value)=each %hash){ # dumb example for my $key2 (keys %hash){ if(lc($key) eq lc($key2)){ print "key $key is similiar to $key2\n"; } } }