my $two_d = [ [1,2,3], [4,5,6], [7,8,9], ]; # how many columns? print scalar @$two_d; # how many rows in second column? print scalar @{ $two_d->[1] }; #### use Math::Matrix; use Data::Dumper; my $two_d = [ [1,2,3], [4,5,6], [7,8,9], ]; my $m = Math::Matrix->new($two_d); print Dumper $m;