in reply to Print on closed filehandle
You have a precedence problem. Use or, not ||. See perldoc perlopentut.