in reply to foreach loop with array of arrays
according to the first snippet, $arrays is an array-ref, so you have to dereference it in the second snippet
foreach(@$arrays) { ... }
On a second note: you access the elements of @data via subscript, but the for-loop gives you access to the elements during the iteration in the variable $_:
should be working better; and don't use $a as a variable name, as it has a special meaning.push(@$arrays, [split(/ /, $_)]) for(@data);
regards,
tomte
Hlade's Law:
If you have a difficult task, give it to a lazy person --
they will find an easier way to do it.
|
|---|