quotemeta
Escapes all non-“word” characters with a preceding backslash.
Returns a version of the string where every non-word character
([^A-Za-z0-9_]) is preceded by \. Useful for interpolating
literal strings into regular expressions. If all characters are
already word characters, the input is returned unchanged with
no allocation.
Synopsis
my $safe = quotemeta($string);
$string =~ /\Q$pattern\E/; # \Q invokes quotemeta