Also, why do I have to declare the variables $pfx and $num outside the while loop for this to work properly?
I think that is because the regular expression code blocks create closures around $pfx and $num when the regex is compiled. This means that the assignments will always be to the $pfx and $num that were declared inside the while loop the first time through. I think doing
local our ($pfx, $num);
inside the while would work but I've not tested it.
I hope this is of use.
Cheers,
JohnGG
In reply to Re: Matching Multiple Alternative Patterns and Capturing Multiple Subexpressions
by johngg
in thread Matching Multiple Alternative Patterns and Capturing Multiple Subexpressions
by Jim
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |