in reply to foreach loop with array of arrays
Hardburn is right. And to answer it the other way around, you could also do (using your code):
push(@arrays, [split(/ /,$data[$a])]);
I.e., create an array where each element in the array is a reference to an anonymous array. Then you can iterate that array with for (@arrays).
What you were doing, as Hardburn points out, is creating a scalar reference to an anonymous array, which contained references to anonymous arrays. That's probably overkill for what you intended to do.
-xdg
No warranties, express or implied; code may not be tested; Use at your own risk;
|
|---|