Consider this Perl code
my @a=[[1]];
print $a[0][0];
**output**
ARRAY(0x229e8)
Why does it print an ARRAY instead of 1? I would have expected @a to create an array of size 1 with a reference to a second array containing only one element, 1.
This stuff is tricky. You have assigned
@aas a list containing a reference to an array that contains a reference to an array, which is one more extra level of indirection than you were expecting.To get the results you expect, you should have said