Damian Conway wrote:

Adam D. Lopresto wrote:

Really what I've been wishing for was an operator (or whatever) to let me do an
s// without changing the variable.

I would hope/expect that that's what the subroutine form of C<s> would do.

That is, it takes a string, a pattern, and a replacement string,
and returns a new string with substitution performed (without affecting
the original string):

print 'He said "$( s($statement,/\.$/,"") )", but we didn't believe him.';

That seems a bit obfuscated; is there any chance the subroutine form could
be called C<subst> or C<substitute>?


Reply via email to