You are out of luck with the syntax you wanted. Syntax is syntax, which you have to strictly follow. Logically, You might have a point to use an array element as the loop variable (as long as it is a scalar, however you must realize the difficulty that this schema introduced, as it is not possible to determine the type of an array element statically, thus it is wise not to introduce what you wanted into a language.), but that's not how the language is defined.
You still can do what you wanted to do, inside each level of your quadruple loop, just push the loop variable into an array.
for my $i (...) {
push @iter, $i;
...
for my $j (...) {
push @iter, $j;
...
for my $k (...) {
push @iter, $k;
...
for my $l (...) {
push @iter, $l;
...
}
}
}
}
On the other hand, I trust that, you realize, the inner loops have access to outter loop variables. The reason to push them into an array is not for gaining access of their values, but rather other convenience that you are seeking. |