msnyder424 has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I know that $#A returns the last index of an array @A. And scalar @A returns the number of items in an array @A. But if I have a multi-dimensional array of fields that looks something like this:
@A = ([0,1],[0,...,0],[1,...,1])scalar @A returns the number of items in the first field: 2. OK. $#A returns the last index in the first field: 1. Also OK.
But how do I find out how many zeros are in the second field? Or ones in the third field? I don't really care if its the index of the last item or the actual number of items. Like any good programmer I tried Googling the heck out of this but have come up empty handed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Find number of items in a field multi-demensional array
by Marshall (Canon) on Apr 26, 2018 at 18:55 UTC | |
|
Re: Find number of items in a field multi-demensional array
by stevieb (Canon) on Apr 26, 2018 at 18:45 UTC | |
|
Re^2: Find number of items in a field multi-demensional array
by huck (Prior) on Apr 26, 2018 at 19:08 UTC | |
|
Re: Find number of items in a field multi-demensional array
by haj (Vicar) on Apr 26, 2018 at 18:56 UTC |