Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi all, I'm wondering if it's possible to count the number of substitutions made by s///g? While one could count the matches by doing scalar(@array = m//g), I couldn't find an equivalent for the substitution operator. Is this possible, or do I have to make two runs through the string: one to count, one to substitute?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Count substitutions by s///g
by sauoq (Abbot) on Jul 25, 2003 at 20:21 UTC | |
by Anonymous Monk on Jul 25, 2003 at 20:33 UTC | |
by flounder99 (Friar) on Jul 26, 2003 at 03:08 UTC |