Welcome to the Monastery | |
PerlMonks |
Re: How do I find the size of an array?by dsb (Chaplain) |
on Jan 24, 2001 at 19:47 UTC ( [id://54001]=note: print w/replies, xml ) | Need Help?? |
Very simply. Evaluate the array in scalar context.
Remember that the size of an array is not the same as the last element of an array. Since indexing of elements starts at zero, the last element of a ten-element array is 9. See the following code:
And the output:
5
Originally posted as a Categorized Answer.
In Section
Seekers of Perl Wisdom
|
|