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:
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";
}
test.out is an existing file, tt1 is not.
The output is:
1. [OK]
3. [ERROR]
If I comment out the middle part, the if (-e "tt1") { ... and just simply open & read & close the file twice, I get:
1. [OK]
2. [OK]
This is more, than annoying and more than weird. Could you please suggest any workarounds?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.