in reply to What does $#variable mean?

The construct you see is returning the index of the last element in the array, which is one less than the number of elements in the array.

my @array = (1, 2, 3); print $#array, "\n";
will print "2".