|Welcome to the Monastery|
Re^11: true from (-e "") on Windoze (" is an illegal filename characterby syphilis (Chancellor)
|on Sep 20, 2012 at 01:58 UTC||Need Help??|
I need a function that checks if file exists
Seems to me that (on Windows) we can be assured that the specified $file exists if any one of the following three conditions returns true:
I was also wondering about using -f instead of -e. Are there any files on Windows that will report false for -f ? (If so, then we can't use -f as a test for existence.)
Someone really ought to file a bug report about this because the perldoc -f -X documentation does *not* match the behaviour wrt '-e'.
That documentation implies that -e '""' will return true only if a file named "" exists.
Either the behaviour ought to change to fit the documentation, or the documentation be amended to fit the behaviour.
The documentation also implies that defined -f '""' will return false (but it doesn't).
Here's what I ran as a check:
And here's the output I got:
I don't mind filing a bug report about this, but I'll wait for comments about that first (in case I've overlooked something).