The scope of $<digit> extends to the end of the enclosing BLOCK or eval string, or to the next successful pattern match, whichever comes first.Line 7 of your script is a successful pattern match (a substitution is also a pattern match), so the $<digit> vars go out of scope
Update: removed inaccurate or even plain wrong stuff.
CU
Robartes-
In reply to Re: Modifying value of $1 clobbers $2, $3 etc?
by robartes
in thread Modifying value of $1 clobbers $2, $3 etc?
by Not_a_Number
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |