⭐ in reply to How to prevent metacharacter interpolation
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/;
|
|---|