Returns the value of EXPR with all non-"word"
characters backslashed. (That is, all characters not matching
will be preceded by a backslash in the
returned string, regardless of any locale settings.)
This is the internal function implementing
escape in double-quoted strings.
If EXPR is omitted, uses
) are useful when interpolating strings into
regular expressions, because by default an interpolated variable will be
considered a mini-regular expression. For example:
'The big bad wolf jumped over...'
On the other hand:
Will both leave the sentence as is. Normally, when accepting string input from
the user, quotemeta() or
must be used.
In Perl 5.14, all characters whose code points are above 127 are not quoted in UTF-8 encoded strings, but all are quoted in UTF-8 strings. It is planned to change this behavior in 5.16, but the exact rules haven't been determined yet.