in reply to array of arrays
This line:
my @arrays = ([2,4,6],[8,9,5],[1,2,3]);creates an array of references, like this:
@arrays = ($ref1, $ref2, $ref3);Your array access here:
print $arrays[1][2];is shorthand for:
$arrays[1]->[2]
which is shorthand for:
@{$arrays[1]} [2]
Because the elements of @arrays are references, in order for you to get the second reference, you would write this:
$arrays[1]
And to convert a reference to the actual array (i.e. dereference the reference), you would write this:
@{$arrays[1]}
Braces are used to turn a reference into the thing it references.
|
|---|