Jonathan Scott Duff wrote:
>
> I think that C<subst> is too syntactically close yet semantically far
> from C<substr> that the evil demons of confusion will rear their ugly
> heads.
I agree too, any suggestions are welcome. The fact that 'sub' and
'substr' are already taken makes this tough...
> Given the above, why not make a bare C<subst> do something equally
> useful? Here are some ideas:
>
> subst; # removes leading and trailing whitespace
I like this one alot.
> > next if /\s+/ || /\w+/; next if match /\s+/ or match /\w+/;
>
> Gosh this is annoying. I *really* don't want to have to type "match"
> all the time. And now I have to use C<or> rather than C<||>, which is
> already ingrained in my head (I rarely use "or" or "and")
v2 will clarify this some more and let you type:
next if m/\s+/ or m/\w+/;
Which is essentially the same as now.
> I wonder what happens when people start typing
>
> $new = subst s/old/new/i, $old;
They get a syntax error! :-)
Honestly, I don't think that's a big problem. People don't do this with
split() now. I think people will either use the "backwards compat" s///
form or the function form.
-Nate