sub new { my ( $pkg, $cols, $rows, $firstRow ) = @_; # where first Row is a ref to an array. my @AoA = (); # deref $firstRow and push the first array # into the array or arrays push ( @AoA, @$firstRow ); for( my $row=1; $row<$rows; $row++ ) { push( @AoA, [0..$cols] ); # I bet this wrong } bless { cols => $cols, rows => $rows, AoA => @AoA }, $pkg; } #### sub printElement { $obj = shift; $row = shift; $col = shift; print "AoA[$row][$col] = $obj->{AoA}[$row][$col]; # line 42 }