in reply to Find number of items in a field of a multi-demensional array

I assume that the "fields" are the lists in square brackets? If @A = ([0,1],[0,1,2,3,0],[1,2,3,4,1]) then scalar @A is 3 and $#A is 2. Both count the items in the top-level list, and not the number of items in the first field. To count items of a specific field you need to isolate that field, and then use something like scalar grep { BLOCK } @list for counting:
my @A = ([0,1],[0,1,2,3,0],[1,2,3,4,1,1,1,11]); my $zeroes = scalar grep { $_ == 0 } @{$A[1]}; my $ones = scalar grep { $_ == 1 } @{$A[2]}; print "Scalar : ", scalar @A, "\n"; print "Last index: $#A\n"; print "Zeroes in second field: $zeroes\n"; print "Ones in third field: $ones\n";

Replies are listed 'Best First'.