From: Zsban Ambrus
Date: Sun, 9 Jun 2013 13:26:22 +0000 (-0400)
Subject: document the /p flag and related variables in delta
X-Git-Tag: upstream/5.20.0~3185
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9af0006bddac3108a478ad921119bb41c07b088e;p=platform%2Fupstream%2Fperl.git
document the /p flag and related variables in delta
---
diff --git a/pod/perl5100delta.pod b/pod/perl5100delta.pod
index 4e5c6d3..10d71d6 100644
--- a/pod/perl5100delta.pod
+++ b/pod/perl5100delta.pod
@@ -200,6 +200,23 @@ logically match their complements.
C<\R> matches a generic linebreak, that is, vertical whitespace, plus
the multi-character sequence C<"\x0D\x0A">.
+=item Optional pre-match and post-match captures with the /p flag
+
+There is a new flag C
for regular expressions. Using this
+makes the engine preserve a copy of the part of the matched string before
+the matching substring to the new special variable C<${^PREMATCH}>, the
+part after the matching substring to C<${^POSTMATCH}>, and the matched
+substring itself to C<${^MATCH}>.
+
+Perl is still able to store these substrings to the special variables
+C<$`>, C<$'>, C<$&>, but using these variables anywhere in the program
+adds a penalty to all regular expression matches, whereas if you use
+the C flag and the new special variables instead, you pay only for
+the regular expressions where the flag is used.
+
+For more detail on the new variables, see L; for the use of
+the regular expression flag, see L and L.
+
=back
=head2 C