|Syntactic Confectionery Delight|
Answer: How do you open a filehandle to a DOS file which has spaces in the filename?
This is not a problem unique to DOS, all operating systems are prone to this problem. What is worse, if the file has leading spaces, Perl will silently strip those spaces out, causing the call to fail.
If you don't believe this, try running the following commands (under Unix).
This outputs bletch: No such file or directory.
This is due to the way Perl looks for < and > meta-characters to determine what mode to use (input or output). The most reasonable portable and documented method to work around this bug is to use sysopen in the place of open. In any event, you will need to use the Fcntl module to get this working correctly (part of the core distribution).
Here are the most common cases to get you started:
Just slap a use Fcntl at the top of your program, and drop in the sysopen replacements for each open statement, remembering of course to test the truth (success) of the statement and printing the contents of $! when things go awry.
See also Two-arg open() considered dangerous.