Re: copying and s/// (was Re: Overlapping RFCs 135 138 164)
[email protected] (Nathan Wiger)
| Newsgroups | perl.perl6.language.regex |
|---|---|
| Message-ID | <[email protected]> |
Uri Guttman wrote:
>
> TC> ($this = $that) =~ s/foo/bar/;
> TC> for (@these = @those) { s/foo/bar/ }
>
> TC> You can't really do those in one step without it.
RFC 164 v2 has a new syntax that lets you do the above or, if you want:
$this = s/foo/bar/, $that;
@these = s/foo/bar/, @those;
Consistent with split, join, splice, etc, etc.
> but we need a better syntax for s/// that doesn't modify its string but
> returns a copy which has had the substitution applied to it.
See RFC 164 v2, all this is supported, as well as this:
@str =~ s/foo/bar/;
Which has been a pipe dream for some time.
-Nate