in reply to Question on arrays

When going through an array, a for() loop will keep track the index of the element it's at, so it knows what the next element will be.
for (@array) { ... } # is kind of like for ($i = 0; $_ = $array[$i], $i < @array; $i++) { ... }