In perl.git, the branch avar/v5.26.0-RC1-perldelta-fixes has been updated <http://perl5.git.perl.org/perl.git/commitdiff/d91c04bdd0f94bf822a667d59be9ecad023b1a7e?hp=289b04bea713d81dbabd7076c3c5a492894444bc>
- Log ----------------------------------------------------------------- commit d91c04bdd0f94bf822a667d59be9ecad023b1a7e Author: Yves Orton <[email protected]> Date: Wed May 17 14:59:53 2017 +0200 fixup docs for @^CAPTURE ----------------------------------------------------------------------- Summary of changes: pod/perldelta.pod | 16 ++++++++++------ pod/perlvar.pod | 7 +++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 2932386447..b0db26ec15 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -87,16 +87,20 @@ that your code is being invoked by a toolchain module of some sort. =head2 @{^CAPTURE}, %{^CAPTURE}, and %{^CAPTURE_ALL} C<@{^CAPTURE}> exposes the capture buffers of the last match as an -array. So C<$1> is C<${^CAPTURE}[0]>. +array. So C<$1> is C<${^CAPTURE}[0]>. This is a more efficient equivalent +to code like C<substr($matched_string,$-[0],$+[0]-$-[0])>, and you don't +have to keep track of the C<$matched_string> either. This variable has no +single character equivalent. Note like the other regex magic variables +the contents of this variable is dynamic, if you wish to store it beyond +the lifetime of the match you must copy it to another array. -C<%{^CAPTURE}> is the equivalent to C<%+> (ie named captures) +C<%{^CAPTURE}> is the equivalent to C<%+> (ie named captures). Other than +being more self documenting there is no difference between the two forms. C<%{^CAPTURE_ALL}> is the equivalent to C<%-> (ie all named captures). +Other than being more self documenting there is no difference between the +two forms. -Unlike e.g. the C<@-> replacement for the C<$&> regex variable there's -no performance reason to use these new synonyms. They've purely been -added for clarity similar to the L<English>.pm synonyms for various -variables documented in L<perlvar>. =head2 Unicode 9.0 is now supported diff --git a/pod/perlvar.pod b/pod/perlvar.pod index 2f776489be..0bd747184f 100644 --- a/pod/perlvar.pod +++ b/pod/perlvar.pod @@ -925,8 +925,8 @@ Mnemonic: like \digits. =item @{^CAPTURE} X<@{^CAPTURE}> X<@^CAPTURE> -An array which contains the capture buffers, if any, of the last -successful pattern match, not counting patterns matched +An array which exposes the contents of the capture buffers, if any, of +the last successful pattern match, not counting patterns matched in nested blocks that have been exited already. Note that the 0 index of @{^CAPTURE} is equivalent to $1, the 1 index @@ -940,6 +940,9 @@ should output "f-o-a-l". See also L</$I<digits>>, L</%{^CAPTURE}> and L</%{^CAPTURE_ALL}>. +Note that unlike most other regex magic variables there is no single +letter equivalent to C<@{^CAPTURE}>. + This variable was added in 5.25.7 =item $MATCH -- Perl5 Master Repository
