http://www.perlmonks.org?node_id=6103


in reply to How do I escape meta-characters in a user-defined string?

if($string=~/\Q$key\E/){
Quotes the metacharacters.