Note my() can occur inside any block { } (not just at start of subroutine) and defines variables local to the block |
The line |
$LoL2D[$i] = \@list; |
also creates a 2D array, but \@list is same location each time and so $LoL2D[$i][$j] gives the same answer (i.e., the final @list returned) regardless of the value of $i |
In $Lol2D[$x][$y] one stores an array labelled by $x of hard references |
Each hard reference is to an anonymous 1D array whose elements are accessed by $y |