On Wed, Aug 16, 2000 at 03:04:19PM -0000, Perl6 RFC Librarian wrote:
> =head1 ABSTRACT
> 
> Provide a simple way of giving a count of matches of a pattern.

We already have this:

        $count = () = m/foo/g;

> =head1 DESCRIPTION
> 
> m//gt would be defined to do the match, and return the count of matches, this 
> leaves all existing uses consistent and unaffected.  /t is suggested for
> "counT", as /c is already taken.  Using /t without /g would be result in
> only 0 or 1 being returned, which is nearly the existing syntax.

Better would be to redefine what m//g means in a scalar context. 

        $_ = "foofoofoofoofoofoofoo";
        $count = m/foo/g;

1 is just as true as 7.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to