Re^3: print() on closed filehandle
by ikegami (Patriarch) on Dec 14, 2004 at 16:14 UTC
|
| [reply] |
|
|
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.
| [reply] |
|
|
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.
| [reply] |
|
|
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.
| [reply] [d/l] [select] |
|
|
|
|
|
|
|
| [reply] |
|
|
|
|
Re^3: print() on closed filehandle
by davis (Vicar) on Dec 14, 2004 at 15:57 UTC
|
The correct answer is: "Try it, or read perldoc -f open". The short answer is that using ">" in your open will (attempt to) open the file, clobbering (ie removing) its contents, or creating the file anew if necessary.
Update: added documentation pointer.
davis
It wasn't easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.
| [reply] |
|
|
But my question really regards the system called statement.
| [reply] |
|
|
| [reply] |
|
|