in reply to Counting in regular expressions
Anyway, when you use the /g modifier with a pattern match, you can capture all of the matches into a list, eg:
And then the count you are after is simply the number of items in the list:my @digits = ($input =~ m/\d/g);
Rinse, lather, repeat, etc...print scalar @digits;
Hope this helps,
Darren :)
|
|---|