in reply to array element as foreach iterator
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); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: array element as foreach iterator
by nobull (Friar) on Jan 27, 2005 at 18:33 UTC | |
|
Re^2: array element as foreach iterator
by kingm61 (Initiate) on Jan 27, 2005 at 17:14 UTC |