perl 5.8.8 on a recent fedora:
I was attempting to see if the same file existed in two directories. So I set up:
my $d1 = 'mydir/filename';
my $d2 = 'myotherdir/filename';
print "both places" if -e $d1 && -e $d2;
Both directories already exist and I have full access to each one and own each one.
Then I placed the file in the dir in d1, and NOT in the dir in d2, and ran the script. It printed "both places"...
So I pulled it into the debugger and broke at *if*. Then did
dbg> x -e $d1
dbg> x -e $d2
dbg> x $d2
then I cut /myotherdir/ form the result and dropped to linux and ls'ed it and there it was, no issues.
HOW would -e return undef on an existing dir to which I have 777 access? to make matters worse, I then tried
if ( -e $d1 && defined -e $d2 && $d2 )
and it was TRUE! I checked inside the loop and -e $d2 was undef, yet this statement returned true.
I ALSO went to the docs for -e and I didn't see ANY conditions described in which it would EVER return undef (although I might expect it to, if the dir structure was improper, etc so perhaps the docs are incomplete). But in my case, my directory is correct.
Fridays are sposed to NOT go this way.. ack!