In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/51a1303ca5c496ad5fb0bb3bc37f2b3584e845b9?hp=19e72bbfd5503a61638e11c81447172bd42fc89f>

- Log -----------------------------------------------------------------
commit 51a1303ca5c496ad5fb0bb3bc37f2b3584e845b9
Author: Brian Fraser <frase...@gmail.com>
Date:   Fri Oct 7 00:12:38 2011 -0300

    Clarification in perlre.pod about captures created inside a DEFINE
-----------------------------------------------------------------------

Summary of changes:
 pod/perlre.pod |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/pod/perlre.pod b/pod/perlre.pod
index dafe4cf..8f6a04f 100644
--- a/pod/perlre.pod
+++ b/pod/perlre.pod
@@ -1560,6 +1560,19 @@ after the recursion returns, so the extra layer of 
capturing groups is
 necessary. Thus C<$+{NAME_PAT}> would not be defined even though
 C<$+{NAME}> would be.
 
+Finally, keep in mind that subpatterns created inside a DEFINE block
+count towards the absolute and relative number of captures, so this:
+
+    my @captures = "a" =~ /(.)                  # First capture
+                           (?(DEFINE)
+                               (?<EXAMPLE> 1 )  # Second capture
+                           )/x;
+    say scalar @captures;
+
+Will output 2, not 1. This is particularly important if you intend to
+compile the definitions with the C<qr//> operator, and later
+interpolate them in another pattern.
+
 =item C<< (?>pattern) >>
 X<backtrack> X<backtracking> X<atomic> X<possessive>
 

--
Perl5 Master Repository

Reply via email to