in reply to Re^2: print() on closed filehandle
in thread print() on closed filehandle

It can fail for numerous reasons. The most common are probably:

Replies are listed 'Best First'.
Re^4: print() on closed filehandle
by Win (Acolyte) on Dec 14, 2004 at 16:28 UTC
    I am referring to a file that is on another drive, a shared network drive. But I have done this with the input file that is used in the same system call. The file name is fine and so is the directory path. The permissions on the directory are fine.

      Yes, but when you open, and check the return value as recommended previously with the "or die $!" conditional, what error gets printed? That's an important part of the puzzle, you've got to check it.

      There is a possibility that you don't have write permissions in the network drive, or that your script isn't running with the correct permissions (especially if it's a CGI script, or being called by a CGI script, for example).

      Or there could be a network issue. Just try it with that "open FH, '>', $filename or die $!" statement and see that the error message is.


      Dave

      If you're so sure the open worked, how come you can't print to the handle? What is the objection you have to adding an error check? As those to whom you came for help, we're telling you that you should check if open succeeded.
        I did check and it came back with the error message.

      How you are reading the permissions? Reading FLAT_FILE requires less permissions than writing to OUTPUT_FILE.

        Please explain further.