Re: question about data structures - what does $# mean?



sanjeeb schreef:

$#array gives the last index of the array not the number of elements
in the array, so you need to add 1 to $#array to get the number of
elements.

For a Perl array, the number of elements is *normally* equal to the last
index plus one, but not *necessarily*.
Check out "$[" in perlvar.

--
Affijn, Ruud

"Gewoon is een tijger."

.



Relevant Pages