@_=($str =~ m/$pattern/g) and $count=1+$#_; [download]
In reply to Re: Re: Getting the number of times a regexp matches by t0mas in thread Getting the number of times a regexp matches by MeowChow