in reply to Array of array

Did you test what is in your array?

Push just adds the values in the second array to the end of the first array. What you have is a flattened list rather than an array of arrays.

If you want to add a reference to an array you need to push(@mainarr,\@arr1);
Then you can access the second element of each using

for $array_ref (@mainarr){ print "$array_ref->[1]\n"; }

For further info have a look at perldoc perllol