Aug 21, 2012, 1:55 PM
-1 is used when specifying/accessing the last element in the array. It has nothing to do with the length (or size) of the array.
Re: [jazzo] insert numbers in array using standard input
my @array = qw|first second third fourth fifth|;
print $array[-1]; # prints fifth
print $array[-2]; # prints fourth
print $array[-3]; # prints third
(This post was edited by FishMonger on Aug 21, 2012, 1:55 PM)