summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorDavid Nicol <davidnicol@gmail.com>2008-05-09 18:14:29 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-05-18 08:56:12 +0000
commite9d89077a60de61f809018ce831b9605072266b7 (patch)
tree5716f040332c0a8ff12d5c0e4061a975dbd3fd91 /pod
parent03b22f1b10d67ab063304de6dc37c76d815ca050 (diff)
downloadperl-e9d89077a60de61f809018ce831b9605072266b7.tar.gz
New separations for the pattern match operator documentation,
suggested by David Nicol: Subject: It's wafer thin! From: "David Nicol" <davidnicol@gmail.com> Message-ID: <934f64a20805091114y40595f9ap9d355b39f20779c1@mail.gmail.com> p4raw-id: //depot/perl@33852
Diffstat (limited to 'pod')
-rw-r--r--pod/perlop.pod6
1 files changed, 6 insertions, 0 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod
index 1827757a5a..7cac1deddf 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -1151,6 +1151,8 @@ the life of the script. However, mentioning C</o> constitutes a promise
that you won't change the variables in the pattern. If you change them,
Perl won't even notice. See also L<"qr/STRING/msixpo">.
+=item The empty pattern //
+
If the PATTERN evaluates to the empty string, the last
I<successfully> matched regular expression is used instead. In this
case, only the C<g> and C<c> flags on the empty pattern is honoured -
@@ -1167,6 +1169,8 @@ will assume you meant defined-or. If you meant the empty regex, just
use parentheses or spaces to disambiguate, or even prefix the empty
regex with an C<m> (so C<//> becomes C<m//>).
+=item Matching in list context
+
If the C</g> option is not used, C<m//> in list context returns a
list consisting of the subexpressions matched by the parentheses in the
pattern, i.e., (C<$1>, C<$2>, C<$3>...). (Note that here C<$1> etc. are
@@ -1213,6 +1217,8 @@ search position to the beginning of the string, but you can avoid that
by adding the C</c> modifier (e.g. C<m//gc>). Modifying the target
string also resets the search position.
+=item \G assertion
+
You can intermix C<m//g> matches with C<m/\G.../g>, where C<\G> is a
zero-width assertion that matches the exact position where the previous
C<m//g>, if any, left off. Without the C</g> modifier, the C<\G> assertion