From: Gurusamy Sarathy Date: Sun, 20 Feb 2000 11:14:36 +0000 (+0000) Subject: revise docs on @+ and @- (from Tom "Camel" Christiansen) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4ba05bdca841ced94aa583a51f92e8ba338c00d2;p=p5sagit%2Fp5-mst-13.2.git revise docs on @+ and @- (from Tom "Camel" Christiansen) p4raw-id: //depot/perl@5159 --- diff --git a/pod/perlvar.pod b/pod/perlvar.pod index 17b570f..285a0d5 100644 --- a/pod/perlvar.pod +++ b/pod/perlvar.pod @@ -176,16 +176,16 @@ This variable is read-only and dynamically scoped to the current BLOCK. =item @+ -$+[0] is the offset of the end of the last successful match. -C<$+[>IC<]> is the offset of the end of the substring matched by -I-th subpattern, or undef if the subpattern did not match. - -Thus after a match against $_, $& coincides with C. Similarly, C<$>I coincides with CIC<], -$+[>IC<] - $-[>IC<]> if C<$-[>IC<]> is defined, and $+ coincides with -C. One can use C<$#+> to find the number -of subgroups in the last successful match. Contrast with -C<$#E<45>>, the last I subgroup. Compare with C<@E<45>>. +This array holds the offsets of the ends of the last successful +submatches in the currently active dynamic scope. C<$+[0]> is +the offset into the string of the end of the entire match. This +is the same value as what the C function returns when called +on the variable that was matched against. The Ith element +of this array holds the offset of the Ith submatch, so +C<$+[1]> is the offset past where $1 ends, C<$+[2]> the offset +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 $MULTILINE_MATCHING @@ -426,6 +426,33 @@ matched subgroup in the last successful match. Contrast with C<$#+>, the number of subgroups in the regular expression. Compare with C<@+>. +This array holds the offsets of the beginnings of the last +successful submatches in the currently active dynamic scope. +C<$-[0]> is the offset into the string of the beginning of the +entire match. The Ith element of this array holds the offset +of the Ith submatch, so C<$+[1]> is the offset where $1 +begins, C<$+[2]> the offset where $2 begins, and so on. +You can use C<$#-> to determine how many subgroups were in the +last successful match. Compare with the C<@+> variable. + +After a match against some variable $var: + +=over 5 + +=item C<$`> is the same as C) + +=item C<$&> is the same as C) + +=item C<$'> is the same as C) + +=item C<$1> is the same as C + +=item C<$2> is the same as C + +=item C<$3> is the same as C) + +=back + =item format_name HANDLE EXPR =item $FORMAT_NAME