Programming Tips - How do I declare, initialize and use 2D arrays in perl?

Date: 2012mar24 Language: perl Q. How do I declare, initialize and use 2D arrays in perl? A. Unlike compiled languages like C++ or Java you don't declare variable to be a 2D array. In Perl you make an array of array:
my @AoA = ( [ "fred", "barney" ], [ "george", "jane", "elroy" ], [ "homer", "marge", "bart" ], );
Notice there are round brackets on the outside and square brkacets on the inside. More info http://perldoc.perl.org/perldsc.html#ARRAYS-OF-ARRAYS