$#arrayname returns the number of the last subscript in the array.
$[ variable is the current array base subscript, zero.
@grades = (0,1,2,3,4);
print "The array is: @grades\n";
print "last index is $#grades\n";
$#grades=3;
print "The array is truncated to 4 elements: @grades\n";
@grades=();
print "The array is completely truncated: @grades\n";
|