in reply to Array of arrays problem

I figured out the problem...

My past code reveals that once upon a time, I knew that when building up my array of arrays, I needed to use syntax like:

push @myArrayOfArrays, [ @myOtherArray ];

But there seems to have been some corrupted memory in my carbon-based processor, because this time around I would have never guessed about using those square brackets.

Replies are listed 'Best First'.
Re^2: Array of arrays problem
by ikegami (Patriarch) on Apr 16, 2008 at 19:15 UTC

    push @myArrayOfArrays, @myOtherArray;
    means
    push @myArrayOfArrays, $myOtherArray[0], $myOtherArray[1], ..., $myOtherArray[n];

    [ @myOtherArray ]
    creates an array, copies @myOtherArray into it, an returns a reference to the new array, so
    push @myArrayOfArrays, [ @myOtherArray ];
    appends an array reference to @myArrayOfArrays instead of simply appending the contents of @myOtherArray.