in reply to Arrays: Last-index special variable vs. scalar values

You have a slight confusion, it seems, over what "index of the last element" means. You seem to think it means "value of the last element." It doesn't.

If you have:

@a = (1,3,5);
the index of the last element is 2, because
$a[2]
is the last element. The *value* of the last element is "5", but that's neither here nor there.

Does that make sense?