Wow, thanks for all the replies. I'm surprised no one commented on my question about
the matching operator itself:
> Does anyone know why m//g only returns true on success instead of
> returning the number of matches like s///g and tr/// do.
I realize I'm not identifying some major flaw in the language and but I can't think of
any reason why m//g was made not to return the number of matches while s///g was. It
just seems like it should.
Oh well... :)
>
>Does anyone know how to count the number of times a regex (global) matches?
>
>According to the docs, m/$pattern/g will return true (which I think is "1") upon
>success, but not the >nubmer of times matched.
>
>I tried the following:
> $count = @matches = /$pattern/g;
>
>and this works, but it seems like there must be a more straightforward way to do it.
>
>Does anyone know why m//g only returns true on success instead of returning the
>number of matches like >s///g and tr/// do.
>
>Thanks.
>-- Brad
>