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

The directory exists. I have write access to this directory when I do it manually. But when I try to write to this directory with a Perl program it won't let me. Has anyone come across this before?

Replies are listed 'Best First'.
Re^13: print() on closed filehandle
by ysth (Canon) on Dec 15, 2004 at 10:21 UTC
    Try including both $! and $^E in the or die clause and see what that shows. If you manually create an empty file with the name the perl script will use, does that make it's open work?
      I tried to create a empty file before, and that didn't work. What does $^E do?
        From perlvar:
        $EXTENDED_OS_ERROR
        $^E
        Error information specific to the current operating system. At the moment, this differs from $! under only VMS, OS/2, and Win32 (and for MacPerl). On all other platforms, $^E is always just the same as $!.

        Under Win32, $^E always returns the last error information reported by the Win32 call GetLastError() which describes the last error from within the Win32 API. Most Win32-specific code will report errors via $^E. ANSI C and Unix-like calls set errno and so most portable Perl code will report errors via $!.

        Sorry I'm wrong ..... I tried again to create the file in advance ..... and it works this time when I do that. So the take home point from this discussion is that when using ">" to create or use a file on a shared Network, within a MS environment, then the file will not be created in the event of it being absent. Perhaps this is something that the Perl developers need to look at.