Aristotle already told you what you have to do and the reason why is because automagic assignment to $_ is a short-cut. It's meant as a convience for those situations where you don't really want or need to declare another variable for a simple loop. But when you have multiple nested loops the convience of $_ is largely lost so you should name your loop variables explicitly (all but one of them anyway :).
Things like $_2 are more obfuscatory than useful IMHO
In reply to Re: nested for loop with assumed scalars
by duff
in thread nested for loop with assumed scalars
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |