It's going through all the elements of @lines except the last one. $#lines is the index of the last element of @lines. So 0..($#lines - 1) is therefore the range from zero to index of the next-to-last element. So @lines[0..($#lines - 1)] is a slice of all but the last element.
Caution: Contents may have been coded under pressure.