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.
In reply to Re: Basic regex question
by FunkyMonk
in thread Basic regex question
by chaitins_omega
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |