>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.
That looks tremendously *IN*consistent, since now you must alter
the laws of precedence! :-(
% perl -MO=Deparse,-p -e '$this = s/foo/bar/, $that;'
(($this = s/foo/bar/), $that);
>> 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.
I can't imagine that the number of elements in @str constains
the string "foo". Or has one decided that @array in scalar
context no longer returns that?
Anyway, this is nothing we don't have, or which is broken.
We already have the highly readable:
for (@str) { s/foo/bar/ }
Why do you want to magically use scalar operators on arrays? This
was suggested back as early as perl1 or so because people wanted
to write @a + @b and even @a + 2, and Larry wasn't interested in
doing that. That's a big new world.
--tom