develooper Front page | perl.perl6.language | Postings from June 2005

Re: Lvalue Str::words iterator

Thread Previous | Thread Next
June 15, 2005 12:46
Re: Lvalue Str::words iterator
Message ID:
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//.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About