Re: RFC 110 (v3) counting matches

[email protected] (Damien Neil)
Newsgroups perl.perl6.language.regex
Message-ID <[email protected]>
On Mon, Aug 28, 2000 at 01:30:41PM -0500, Jarkko Hietaniemi wrote:
> >     $count = () = $string =~ /pattern/g;
> 
> Which I find cute as a demonstration of the Perl's context concept,
> but ugly as hell from usability viewpoint.  I how to assign to an
> empty list to get a number of something?  Hello?  This harks back to
> the dirty (similarly cute, but still dirty) (c(a(s(t)))) games of C.
> It may be an idiom but it still doesn't sing to me.

It's pretty far from perfect, but I do find the above much easier
to understand than

  $count = $string =~ /pattern/t;

There are far too many regexp option modifiers as it stands.  I don't
think adding new ones for functionality which can be derived from the
existing ones is going to help anyone.  I'm quite certain that a
t modifier sings less for me than the existing idiom.

                      - Damien
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.