Hi, I have some problems with an Array of Array.
The number of rows are known from the beginning, but the number of elements in each row is variable (and could be zero). For example, I could initialize this structure as:
Now the question is, how do I loop through this array, without keeping separate records of the number of elements in each row? If the row is empty it should just be skipped. This does not work:
Please help! Thanks.
The number of rows are known from the beginning, but the number of elements in each row is variable (and could be zero). For example, I could initialize this structure as:
Code:
my @AoA = ([],[],[0,1],[],[],[2,3,4]);
Now the question is, how do I loop through this array, without keeping separate records of the number of elements in each row? If the row is empty it should just be skipped. This does not work:
Code:
for ($i=0;$i<6;$i++)
{
foreach $j @AoA[$i]
...
}}
Please help! Thanks.