From 33786e4c73dd9562bcdee8a12fba6bb17510764f Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Fri, 20 Nov 2020 15:57:25 -0800 Subject: [PATCH] add extra language in the quotemeta() docs for embedded \ and $ One paragraph was lifted from perlop.pod, and the other from perlre.pod. --- pod/perlfunc.pod | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 9f0c8208a0..d1c2ffaba4 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -6149,6 +6149,18 @@ Will both leave the sentence as is. Normally, when accepting literal string input from the user, L|/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 to use literal backslashes within C<\Q...\E>, +consult L. + +Because the result of S \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.