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

Re: Lvalue Str::words iterator

Thread Previous | Thread Next
From:
Juerd
Date:
June 15, 2005 12:46
Subject:
Re: Lvalue Str::words iterator
Message ID:
20050615194639.GP7412@c4.convolution.nl
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 Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About