$end = $#rocks; #99, which is the last element's index $number_of_rocks = $end + 1 #okay, but you'll see a better way later $rocks[$#rocks] = 'hard rock' #the last rock