This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add s///r (non-destructive substitution).
authorDavid Caldwell <david@porkrind.org>
Tue, 24 Nov 2009 01:24:25 +0000 (17:24 -0800)
committerDavid Caldwell <david@porkrind.org>
Sat, 22 May 2010 09:28:22 +0000 (02:28 -0700)
commit4f4d7508b0c2c114e5f52420e0e87a853c5f642a
tree008d80915d83e246892b83fa06e46a3b2e21c6bf
parentdd9035cd5bdeced1187df399d27d526f3b30194b
Add s///r (non-destructive substitution).

This changes s/// so that it doesn't act destructively on its target.
Instead it returns the result of the substitution (or the original string if
there was no match).

In addition this patch:

  * Adds a new warning when s///r happens in void context.
  * Adds a error when you try to use s///r with !~
  * Makes it so constant strings can be bound to s///r with =~
  * Adds documentation.
  * Adds some tests.
  * Updates various debug code so it knows about the /r flag.
  * Adds some new 'r' words to B::Deparse.
14 files changed:
dist/B-Deparse/Deparse.pm
dump.c
ext/B/t/concise-xs.t
op.c
op.h
pod/perlop.pod
pod/perlrequick.pod
pod/perlreref.pod
pod/perlretut.pod
pp_ctl.c
pp_hot.c
regexp.h
t/re/subst.t
toke.c