in reply to Re^2: Pattern matching with hash keys
in thread Pattern matching with hash keys

If $str contains "Rabbit" or "rabbit" i want it to be replaced with "pap".
Hashes, by default, are case sensitive. However, if you take care to create the hash with all lower case keys, you could then simply lower case each input string, for example:
use strict; use warnings; my %hash = ( "rabbit" => "pap", "triangle" => "tri" ); my $key = "rabbit"; print $hash{ lc($key) }, "\n"; # prints "pap" $key = "Rabbit"; print $hash{ lc($key) }, "\n"; # also prints "pap"