summaryrefslogtreecommitdiff
path: root/pod/perlop.pod
diff options
context:
space:
mode:
authorM. J. T. Guy <mjtg@cus.cam.ac.uk>1998-07-07 16:59:03 +0100
committerGurusamy Sarathy <gsar@cpan.org>1998-07-08 02:25:17 +0000
commit7e86de3e163f833ae89c22b4ee3418ae793e26c5 (patch)
tree3b1a3ba3b7c8ee3a8f3d94965294a060f3262450 /pod/perlop.pod
parent970ed2020efd7ea2be3bbbe0dc9c941d3a8658fd (diff)
downloadperl-7e86de3e163f833ae89c22b4ee3418ae793e26c5.tar.gz
applied patch to clarify m//g
Message-Id: <E0ytZCx-0006Bi-00@taurus.cus.cam.ac.uk> Subject: [PATCH] Re: m//g in perlop.pod p4raw-id: //depot/perl@1365
Diffstat (limited to 'pod/perlop.pod')
-rw-r--r--pod/perlop.pod16
1 files changed, 7 insertions, 9 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod
index cc657c1446..96427b2a05 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -811,15 +811,13 @@ substrings matched by all the parentheses in the regular expression.
If there are no parentheses, it returns a list of all the matched
strings, as if there were parentheses around the whole pattern.
-In scalar context, C<m//g> iterates through the string, returning TRUE
-each time it matches, and FALSE when it eventually runs out of matches.
-(In other words, it remembers where it left off last time and restarts
-the search at that point. You can actually find the current match
-position of a string or set it using the pos() function; see
-L<perlfunc/pos>.) A failed match normally resets the 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.
+In scalar context, each execution of C<m//g> finds the next match,
+returning TRUE if it matches, and FALSE if there is no further match.
+The position after the last match can be read or set using the pos()
+function; see L<perlfunc/pos>. A failed match normally resets the
+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.
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