in reply to readline() on unopened filehandle

I think you may want to read up on eof. In any case that last wouldn't do anything useful in any case: despite the name of your label, it seems to me that at all effects you're not leaving an outer loop, and you're already iterating over a file. You're also missing a line every two. Do you really want to?

To answer your question, anyway, on the last line of your input file the file itself gets closed, so you can operate on that $line, but you can't read further lines. What did you expect to do?!? Update: ignore this, I didn't notice your typo. Right answer e.g. at Skeeve's reply.