( categories: array )
Array index values start from zero.To obtain the last index value of an array ('n-1' if the array has 'n' elements), use the following syntax:
$#array
To get the value of the last element of the array, you can either do:
$array[$#array]
or
$array[-1]
Example:
@array = qw(rock paper scissors);
print "Last index value of array: " . $#array . "\n";
print "Value of last element of array: " . $array[-1] . "\n";





