Re: Lvalue Str::words iterator
by Juerd other posts by this author
Jun 15 2005 12:46PM messages near this date
Re: Lvalue Str::words iterator
|
Re: Lvalue Str::words iterator
Ingo Blechschmidt skribis 2005-06-15 21:35 (+0200):
> So maybe we should allow words() (or however we'll end up calling it) to
> take an optional parameter specifying what's considered a wordchar,
> with a default of rx/\w+/:
Then isn't making \w+ the default for match much easier?
(Although I still want m// to correspond to .m and s/// to .s, not m//
to .match and s/// to .subst.)
I think this is so often used that the default isn't even as insane as
it may appear at first sight.
> say "foo bar baz".words() .join(":"); # same as
say "foo bar baz".match
> say "foo bar baz".words(rx/\w+/) .join(":"); # "foo:bar:baz"
say "foo bar baz".match(/\w+/)
rx is optional, as bare // does rx// in Rule context, not m//.
Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
http://convolution.nl/gajigu_juerd_n.html
Thread:
Ingo Blechschmidt
Juerd
Ingo Blechschmidt
Juerd
Larry Wall
Ingo Blechschmidt
Juerd
|