$num='36737'; $idx=0; while($num=~m/[0-9]{$idx}/) { $idx++; } $idx--; # adjusment to get correct answer print "\n$num has $idx digits ";
Is this what you wanted?
In reply to Re: Calculating variable {n} in regex match
by cheekuperl
in thread Calculating variable {n} in regex match
by atreyu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |