X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlvar.pod;h=c3adfa0a1008f4f8c41bbc904e797f556ac82828;hb=53ae2428795d0b9d42a1657c22c5f1b557784379;hp=4d8c17e84ea3283c1b27667f6251ab442383ace0;hpb=efbd929db929308cc9ae6bdeff1f8f52fb176c53;p=p5sagit%2Fp5-mst-13.2.git
diff --git a/pod/perlvar.pod b/pod/perlvar.pod
index 4d8c17e..c3adfa0 100644
--- a/pod/perlvar.pod
+++ b/pod/perlvar.pod
@@ -228,6 +228,14 @@ performance penalty on all regular expression matches. See L.
See L@-> for a replacement.
+=item ${^MATCH}
+X<${^MATCH}>
+
+This is similar to C<$&> (C<$POSTMATCH>) except that it does not incur the
+performance penalty associated with that variable, and is only guaranteed
+to return a defined value when the pattern was compiled or executed with
+the C
modifier.
+
=item $PREMATCH
=item $`
@@ -243,6 +251,14 @@ performance penalty on all regular expression matches. See L.
See L@-> for a replacement.
+=item ${^PREMATCH}
+X<${^PREMATCH}>
+
+This is similar to C<$`> ($PREMATCH) except that it does not incur the
+performance penalty associated with that variable, and is only guaranteed
+to return a defined value when the pattern was compiled or executed with
+the C modifier.
+
=item $POSTMATCH
=item $'
@@ -264,6 +280,14 @@ performance penalty on all regular expression matches. See L.
See L@-> for a replacement.
+=item ${^POSTMATCH}
+X<${^POSTMATCH}>
+
+This is similar to C<$'> (C<$POSTMATCH>) except that it does not incur the
+performance penalty associated with that variable, and is only guaranteed
+to return a defined value when the pattern was compiled or executed with
+the C modifier.
+
=item $LAST_PAREN_MATCH
=item $+
@@ -313,6 +337,29 @@ past where $2 ends, and so on. You can use C<$#+> to determine
how many subgroups were in the last successful match. See the
examples given for the C<@-> variable.
+=item %+
+X<%+>
+
+Similar to C<@+>, the C<%+> hash allows access to the named capture
+buffers, should they exist, in the last successful match in the
+currently active dynamic scope.
+
+For example, C<$+{foo}> is equivalent to C<$1> after the following match:
+
+ 'foo' =~ /(?foo)/;
+
+The keys of the C<%+> hash list only the names of buffers that have
+captured (and that are thus associated to defined values).
+
+The underlying behaviour of C<%+> is provided by the
+L module.
+
+B C<%-> and C<%+> are tied views into a common internal hash
+associated with the last successful regular expression. Therefore mixing
+iterative access to them via C may have unpredictable results.
+Likewise, if the last successful match changes, then the results may be
+surprising.
+
=item HANDLE->input_line_number(EXPR)
=item $INPUT_LINE_NUMBER
@@ -322,7 +369,7 @@ examples given for the C<@-> variable.
=item $.
X<$.> X<$NR> X<$INPUT_LINE_NUMBER> X
-Current line number for the last filehandle accessed.
+Current line number for the last filehandle accessed.
Each filehandle in Perl counts the number of lines that have been read
from it. (Depending on the value of C<$/>, Perl's idea of what
@@ -568,6 +615,48 @@ After a match against some variable $var:
=back
+=item %-
+X<%->
+
+Similar to C<%+>, this variable allows access to the named capture buffers
+in the last successful match in the currently active dynamic scope. To
+each capture buffer name found in the regular expression, it associates a
+reference to an array containing the list of values captured by all
+buffers with that name (should there be several of them), in the order
+where they appear.
+
+Here's an example:
+
+ if ('1234' =~ /(?1)(?2)(?3)(?4)/) {
+ foreach my $bufname (sort keys %-) {
+ my $ary = $-{$bufname};
+ foreach my $idx (0..$#$ary) {
+ print "\$-{$bufname}[$idx] : ",
+ (defined($ary->[$idx]) ? "'$ary->[$idx]'" : "undef"),
+ "\n";
+ }
+ }
+ }
+
+would print out:
+
+ $-{A}[0] : '1'
+ $-{A}[1] : '3'
+ $-{B}[0] : '2'
+ $-{B}[1] : '4'
+
+The keys of the C<%-> hash correspond to all buffer names found in
+the regular expression.
+
+The behaviour of C<%-> is implemented via the
+L module.
+
+B C<%-> and C<%+> are tied views into a common internal hash
+associated with the last successful regular expression. Therefore mixing
+iterative access to them via C may have unpredictable results.
+Likewise, if the last successful match changes, then the results may be
+surprising.
+
=item HANDLE->format_name(EXPR)
=item $FORMAT_NAME
@@ -958,7 +1047,7 @@ X<$^C> X<$COMPILING>
The current value of the flag associated with the B<-c> switch.
Mainly of use with B<-MO=...> to allow code to alter its behavior
when being compiled, such as for example to AUTOLOAD at compile
-time rather than normal, deferred loading. See L. Setting
+time rather than normal, deferred loading. Setting
C<$^C = 1> is similar to calling C.
=item $DEBUGGING
@@ -1221,7 +1310,7 @@ The revision, version, and subversion of the Perl interpreter, represented
as a string composed of characters with those ordinals. Thus in Perl v5.6.0
it equals C and will return true for
C<$^V eq v5.6.0>. Note that the characters in this string value can
-potentially be in Unicode range.
+potentially be greater than 255.
This variable first appeared in perl 5.6.0; earlier versions of perl will
see an undefined value.