Nathan Wiger <[EMAIL PROTECTED]> wrote:
[...]
> match; # all defaults (pattern is /\w+/?)
> match /pat/; # match $_
> match /pat/, $str; # match $str
> match /pat/, @strs; # match any of @strs
>
> subst; # like s///, pretty useless :-)
> subst /pat/new/; # sub on $_
> subst /pat/new/, $str; # sub on $str
> subst /pat/new/, @strs; # return array of modified strings
[...]
> However, it is worth consideration, in light of RFC 138 and many other
> issues. If we did eliminate =~, I think something like this would work
> pretty well in its place. If anyone thinks this is an idea worthy of an
> RFC (the more I look at it the better it looks, but I'm biased :), let
> me know. Although we'd probably need something better than "subst".
> Maybe just "m" and "s" still.
I think it is worth a RFC. I like:
m /pat/; # match $_
m /pat/, $str; # match $str
m /pat/, @strs; # match any of @strs returning count in scalar
# context, matching strings in array context
m /pat/, @strs, $number; # match any of first $number ($number > 0)
# or last $number ($number < 0) @strs
# returning count in scalar context, matching
# strings in array context
s /pat/new/; # sub on $_
s /pat/new/, $str; # sub on $str
s /pat/new/, @strs; # sub on @strs returning count in scalar context,
# changed strings in array context
s /pat/new/, @strs, $number; # sub any of first $number ($number > 0)
# or last $number ($number < 0) @strs
# returning count in scalar context, changed
# strings in array context
Mark