In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/bc7b91c69b5d1be1099b256e45d4fa59164df78c?hp=7ec2c349a5d9e979773c2f7c684c26ebde61cf67>

- Log -----------------------------------------------------------------
commit bc7b91c69b5d1be1099b256e45d4fa59164df78c
Author: Eric Brine <[email protected]>
Date:   Mon Oct 11 17:17:15 2010 -0700

    Improve documentation of \Q
-----------------------------------------------------------------------

Summary of changes:
 pod/perlop.pod |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/pod/perlop.pod b/pod/perlop.pod
index 707df4a..4e1d217 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -1224,10 +1224,24 @@ C<join $", @array>.    "Punctuation" arrays such as 
C<@*> are only
 interpolated if the name is enclosed in braces C<@{*}>, but special
 arrays C<@_>, C<@+>, and C<@-> are interpolated, even without braces.
 
-You cannot include a literal C<$> or C<@> within a C<\Q> sequence.
-An unescaped C<$> or C<@> interpolates the corresponding variable,
-while escaping will cause the literal string C<\$> to be inserted.
-You'll need to write something like C<m/\quser...@\qhost/>.
+For double-quoted strings, the quoting from C<\Q> is applied after
+interpolation and escapes are processed.
+
+    "abc\Qfoo\tbar$s\Exyz"
+
+is equivalent to
+
+    "abc" . quotemeta("foo\tbar$s") . "xyz"
+
+For the pattern of regex operators (C<qr//>, C<m//> and C<s///>),
+the quoting from C<\Q> is applied after interpolation is processed,
+but before escapes are processed. This allows the pattern to match
+literally (except for C<$> and C<@>). For example, the following matches:
+
+    '\s\t' =~ /\Q\s\t/
+
+Because C<$> or C<@> trigger interpolation, you'll need to use something
+like C</\quser...@\qhost/> to match them literally.
 
 Patterns are subject to an additional level of interpretation as a
 regular expression.  This is done as a second pass, after variables are

--
Perl5 Master Repository

Reply via email to