#!/usr/local/bin/perl use strict; use warnings; my @AoA=( [0, 1, 0, 0], [0, 0, 1, 0,0,0,0,0], [0, 0, 0, 1,0,1] ); # my $row = scalar @AoA; ##Prints the number of rows for the array for(my $i = 0; $i<=$#AoA;$i++){ my $count =0; foreach my $column (@{$AoA[$i]}){ $count ++; } print "Row# ", $i+1, " has $count columns\n"; }