in reply to Basic regex question

You can either use the \Q...\E construct (documented in perlre) within a regex, or the quotemeta function call.

#\E not necessary at end of pattern /^\Q$string/ and print "A match!\n"; #or, same thing $string=quotemeta $string; /^$string/ and print "A match!\n";

update: Re-slanted my slashes. Thanks corion.