⭐ in reply to How to prevent metacharacter interpolation
Use either the quotemeta function:
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 Section
Seekers of Perl Wisdom