in reply to work with Array of Arrays

To count the rows, use scalar In general, if you need to count the number of columns in each row (since they need not be the same), you could use a for loop:
use strict; use warnings; my @AoA=( [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1] ); print 'Number of rows = ', scalar @AoA, "\n"; for my $aref (@AoA) { print 'Number of cols = ', scalar @{$aref}, "\n"; } __END__ Number of rows = 3 Number of cols = 4 Number of cols = 4 Number of cols = 4

See also: