summaryrefslogtreecommitdiff
path: root/pod/perl5100delta.pod
diff options
context:
space:
mode:
authorZsban Ambrus <ambrus@math.bme.hu>2013-06-09 09:26:22 -0400
committerRicardo Signes <rjbs@cpan.org>2013-06-09 09:32:09 -0400
commit9af0006bddac3108a478ad921119bb41c07b088e (patch)
tree1cab3b9b0088de5a6776bfd0a912efa3a07eae8f /pod/perl5100delta.pod
parente7245888eddac196db172b05d1c37f48debd2a10 (diff)
downloadperl-9af0006bddac3108a478ad921119bb41c07b088e.tar.gz
document the /p flag and related variables in delta
Diffstat (limited to 'pod/perl5100delta.pod')
-rw-r--r--pod/perl5100delta.pod17
1 files changed, 17 insertions, 0 deletions
diff --git a/pod/perl5100delta.pod b/pod/perl5100delta.pod
index 4e5c6d3a2b..10d71d686a 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</p> 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</p> 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<perlvar>; for the use of
+the regular expression flag, see L<perlop> and L<perlre>.
+
=back
=head2 C<say()>