AoA means that essentially X[0] is a reference to an array.
Update: "ragged" means that each row has a different number of columns. That is completely fine. Often each row has exactly the same number of elements and that is called a "matrix", like 2 x 3 or 3x5, etc.#!/usr/bin/perl use strict; use warnings; my @X = ([0,1],[0,0,0],[1,1,1,1,1,1,1,1,1]); #This is a ragged 2 D array foreach my $row_ref (@X) { print "num of elements this row: ", scalar (@$row_ref), "\n"; } __END__ num of elements this row: 2 num of elements this row: 3 num of elements this row: 9
A simple array is like: @array=(1,2,3). A 2-D matrix is made up of references to arrays like that. So, essentially the first dimension of the 2D array is an array of references to other arrays that contain the actual data.
scalar @A returns the number of items in the first field. No...that would be the number of rows in the ragged 2D matrix.
In reply to Re: Find number of items in a field multi-demensional array
by Marshall
in thread Find number of items in a field of a multi-demensional array
by msnyder424
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |