http://www.perlmonks.org?node_id=822393


in reply to Re: How do I find the size of an array?
in thread How do I find the size of an array?

$#array + 1 is wrong. $#array is the index of the last element in @array. It is *normally* one less than the number of elements in the array, but not always, as it assumes that array indices start at 0. If $[ is set then that is not necessarily the case.