It's consistent with the documentation, which says a VAR is expected (with an optional my). $y[0] is an expression, not a variable. I suppose it could be considered a limitation, but not a bug.
The following can be used. If you want to next an arbitrary number of loops, check out Algorithm::Loops.
foreach $y0 (@x) { foreach $y1 (@x) { do_something($y0, $y1); } }
In reply to Re: array element as foreach iterator
by ikegami
in thread array element as foreach iterator
by kingm61
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |