will count the matches. If you don't assign the pattern match to an array, m//g will interpret this as a scalar context and only return the first occurrence, and the scalar function will then return 1.$count=scalar(my @dummy = $string=~m/$regex/g);
In reply to Re: number of matches
by Anonymous Monk
in thread number of matches
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |