Consider:
my $str = "12345"; my $count = () = $str =~ /\d/g; print $count;
Prints:
5
The () = puts the regex into list context, then the scalar assignment, as is usual, assigns the countof the items in the list.
In reply to Re: How can I access the number of repititions in a regex?
by GrandFather
in thread How can I access the number of repititions in a regex?
by pat_mc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |