or use the \Q and \E escape characters:$pattern = quotemeta( $pattern ); m/$pattern/;
They do exactly the same thing; just one is a function and the other works inside regex patterns.m/\Q$pattern\E/;
In reply to Re: How to prevent metacharacter interpolation
by jmcnamara
in thread How to prevent metacharacter interpolation
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |