I am trying to make an array of arrays and then reference them.
I make somethign like:
sub foobar
{
my @array;
my $i;
for ($i = 0; $i < 1000; $i=$i+1)
{
my @row;
$row[0] = $i;
$row[1] = foo($bar);
push @array , [@row];
}
return \@array;
}
I can get to the values via:
$array->[x]->[y];
However I don't understand why the second -> is needed. $array->[x] I understand because $array is a reference. But isn't $array->[x] meant to be an array? Why doesn't this work:
my @notarray = $array->[x];
What exactally is not array filled with now? Because it certainly doesn't seem to be an array containing $i , foo($bar)
How would $array->[x]->[y] be different for a reference to an array of references to arrays?