in reply to Re^4: and multiple statements
in thread and multiple statements

Perfectly valid code, but perfectly useless because you can't use the file handle you just opened. You'd have to move the rest of the code into the else body.