monk_of_gaia has asked for the wisdom of the Perl Monks concerning the following question:
1. I open an existing file. Result: OK
2. I try to open or test the existance of a non-existing file with "-e"
3. I open an existing file. Result: ERROR
I tried it with Perl v5.003_07 for Win32 Build 316, Perl v5.004_02 Win32 and 5.005_03 built for MSWin32-x86-object build 518. I have BMC Patrol on this Win2k machine, and these Perls comes with BMC Patrol. It is not possible at this moment to upgrade Perl on this machine.
The test program:
2. I try to open or test the existance of a non-existing file with "-e"
3. I open an existing file. Result: ERROR
I tried it with Perl v5.003_07 for Win32 Build 316, Perl v5.004_02 Win32 and 5.005_03 built for MSWin32-x86-object build 518. I have BMC Patrol on this Win2k machine, and these Perls comes with BMC Patrol. It is not possible at this moment to upgrade Perl on this machine.
The test program:
test.out is an existing file, tt1 is not. The output is:open TT1, "<test.out"; if ($! == 0) { print "1. [OK]\n"; @x = <TT1>; close TT1; } else { print "[ERROR]\n"; } if (-e "tt1") { open TT2, "<tt1"; if ($! == 0) { print "2. [OK]\n"; close TT2; } else { print "2. [ERROR]\n"; } } open TT1, "<test.out"; if ($! == 0) { print "3. [OK]\n"; @x = <TT1>; close TT1; } else { print "3. [ERROR]\n"; }
If I comment out the middle part, the if (-e "tt1") { ... and just simply open & read & close the file twice, I get:1. [OK] 3. [ERROR]
This is more, than annoying and more than weird. Could you please suggest any workarounds?1. [OK] 2. [OK]
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: unable to open existing file after trying to open a non-existing one
by liz (Monsignor) on Sep 23, 2003 at 15:40 UTC | |
by monk_of_gaia (Initiate) on Sep 23, 2003 at 16:00 UTC | |
Re: unable to open existing file after trying to open a non-existing one
by pzbagel (Chaplain) on Sep 23, 2003 at 15:48 UTC | |
Re: unable to open existing file after trying to open a non-existing one
by asarih (Hermit) on Sep 23, 2003 at 15:42 UTC |
Back to
Seekers of Perl Wisdom