in reply to 2d array
You don't need to declare your variable using separate variables and the cumbersome syntax you've used: you're just constructing an array of array-refs (or an array-ref to an array of array-refs). Start by reading perldoc perlref stem-to-stern.