in reply to How do i create array of arrays

my @array = ( 1..3 ); my $arrayRef = \@array; my @arrayOfArrays = ($arrayRef); print $arrayOfArrays[0]->[1];
I hope that helps.

{Editor note by davido: This approach is risky. For one thing, if @array ever changes, its changes will affect @arrayOfArrays. Thus, if you build up an array of arrays using this method inside of a loop, you could end up with multiple instances of the same @array, rather than multiple distinct and unique arrays as the contents of the @arrayOfArrays. Using my within the loop will create a new @array each time through, but better to be explicit about it rather than relying on lexical scoping which can confuse the reader later on.

Changing the second line to:

my @arrayRef = [@array];
will solve the potential problem.