From: David Golden Date: Mon, 24 May 2010 00:04:38 +0000 (-0400) Subject: Add perldelta entry for non-destructive substitution X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c4a6534165d0545c5a1273d7febaa02f28023972;p=p5sagit%2Fp5-mst-13.2.git Add perldelta entry for non-destructive substitution --- 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 section. +=head2 Non-destructive substitution + +The substitution operator now supports a C 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. See L for more examples. + =head1 New Platforms XXX List any platforms that this version of perl compiles on, that previous