In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/c4a6534165d0545c5a1273d7febaa02f28023972?hp=196007d1d65f1413c42844a9656643290de75eb5>
- Log ----------------------------------------------------------------- commit c4a6534165d0545c5a1273d7febaa02f28023972 Author: David Golden <[email protected]> Date: Sun May 23 20:04:38 2010 -0400 Add perldelta entry for non-destructive substitution ----------------------------------------------------------------------- Summary of changes: pod/perl5132delta.pod | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/pod/perl5132delta.pod b/pod/perl5132delta.pod index 69d1b60..549b70a 100644 --- a/pod/perl5132delta.pod +++ b/pod/perl5132delta.pod @@ -31,6 +31,18 @@ XXX New core language features go here. Summarise user-visible core language enhancements. Particularly prominent performance optimisations could go here, but most should go in the L</Performance Enhancements> section. +=head2 Non-destructive substitution + +The substitution operator now supports a C</r> option that +copies the input variable, carries out the substitution on +the copy and returns the result. The original remains unmodified. + + my $old = 'cat'; + my $new = $old =~ s/cat/dog/r; + # $old is 'cat' and $new is 'dog' + +This is particularly useful with C<map>. See L<perlop> for more examples. + =head1 New Platforms XXX List any platforms that this version of perl compiles on, that previous -- Perl5 Master Repository
