Jarkko Hietaniemi writes:
> > 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.
> 
> I like this.  No extra //modifiers to learn.

scalar context of /g is already defined to be something useful.  You'd
have to make a new modifier to indicate you want the old /g behaviour,
which seems ... suboptimal.

Doubling the modifier /gg is not an option.  Doubling a modifier
shouldn't make it do something completely different.

I suggest /n if you want the match to always return the [N]umber of
matches.

Nat

Reply via email to