summaryrefslogtreecommitdiff
path: root/pod/perlop.pod
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@engin.umich.edu>1997-04-12 16:48:41 -0400
committerChip Salzenberg <chip@atlantic.net>1997-04-09 00:00:00 +0000
commita99df21cfa7a5a885ca7e0b0c7aca7e984889792 (patch)
tree6c835e22fa4ff74b117790681ddf4cf9bf6d6bf0 /pod/perlop.pod
parent103ff8e3fc700e65c46dc39d16ec66d203f75af9 (diff)
downloadperl-a99df21cfa7a5a885ca7e0b0c7aca7e984889792.tar.gz
Explain //g and \G issues
private-msgid: 199704122048.QAA25060@aatma.engin.umich.edu
Diffstat (limited to 'pod/perlop.pod')
-rw-r--r--pod/perlop.pod7
1 files changed, 5 insertions, 2 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod
index 45dafaa187..3bd4f21511 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -701,7 +701,10 @@ 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>.) Note that you can use this feature to stack C<m//g>
-matches or intermix C<m//g> matches with C<m/\G.../>.
+matches or intermix C<m//g> matches with C<m/\G.../g>. Note that
+the C<\G> zero-width assertion is not supported without the C</g>
+modifier; currently, without C</g>, C<\G> behaves just like C<\A>, but
+that's accidental and may change in the future.
If you modify the string in any way, the match position is reset to the
beginning. Examples:
@@ -724,7 +727,7 @@ beginning. Examples:
print "1: '";
print $1 while /(o)/g; print "', pos=", pos, "\n";
print "2: '";
- print $1 if /\G(q)/; print "', pos=", pos, "\n";
+ print $1 if /\G(q)/g; print "', pos=", pos, "\n";
print "3: '";
print $1 while /(p)/g; print "', pos=", pos, "\n";
}