This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
update 'say' docs to better represent reality
[perl5.git] / pod / perl5100delta.pod
index 4e5c6d3..6728559 100644 (file)
@@ -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()>
@@ -998,7 +1015,7 @@ The L<perlreapi> manpage describes the interface to the perl interpreter
 used to write pluggable regular expression engines (by Ævar Arnfjörð
 Bjarmason).
 
-The L<perlunitut> manpage is an tutorial for programming with Unicode and
+The L<perlunitut> manpage is a tutorial for programming with Unicode and
 string encodings in Perl, courtesy of Juerd Waalboer.
 
 A new manual page, L<perlunifaq> (the Perl Unicode FAQ), has been added
@@ -1559,7 +1576,7 @@ inherits from C<B::SV> (it used to inherit from C<B::IV>).
 
 The anonymous hash and array constructors now take 1 op in the optree
 instead of 3, now that pp_anonhash and pp_anonlist return a reference to
-an hash/array when the op is flagged with OPf_SPECIAL. (Nicholas Clark)
+a hash/array when the op is flagged with OPf_SPECIAL. (Nicholas Clark)
 
 =head1 Known Problems