mirror of
https://github.com/Perl/perl5.git
synced 2026-01-27 01:44:43 +00:00
add extra language in the quotemeta() docs for embedded \ and $
One paragraph was lifted from perlop.pod, and the other from perlre.pod.
This commit is contained in:
parent
6e46265cd3
commit
33786e4c73
@ -6149,6 +6149,18 @@ Will both leave the sentence as is.
|
||||
Normally, when accepting literal string input from the user,
|
||||
L<C<quotemeta>|/quotemeta EXPR> or C<\Q> must be used.
|
||||
|
||||
Beware that if you put literal backslashes (those not inside
|
||||
interpolated variables) between C<\Q> and C<\E>, double-quotish
|
||||
backslash interpolation may lead to confusing results. If you
|
||||
I<need> to use literal backslashes within C<\Q...\E>,
|
||||
consult L<perlop/"Gory details of parsing quoted constructs">.
|
||||
|
||||
Because the result of S<C<"\Q I<STRING> \E">> has all metacharacters
|
||||
quoted, there is no way to insert a literal C<$> or C<@> inside a
|
||||
C<\Q\E> pair. If protected by C<\>, C<$> will be quoted to become
|
||||
C<"\\\$">; if not, it is interpreted as the start of an interpolated
|
||||
scalar.
|
||||
|
||||
In Perl v5.14, all non-ASCII characters are quoted in non-UTF-8-encoded
|
||||
strings, but not quoted in UTF-8 strings.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user