http://qs1969.pair.com?node_id=204971


in reply to Re: How do I find the index of the last element in an array?
in thread How do I find the index of the last element in an array?

Hmm....actually, that doesn't really help at all!

If you want to know the index of the last element of an array, do this:

@letterList = ("a", "b", "c", "d"); #refer to the last array index #using '$#array' syntax: print $#letterList;
This will, of course, output "3".

You can also refer to the value of the last element of the array
using negative indices, e.g. $letterList[-1] will also refer to "d".

--
Microsoft delendum est.