P is for Practical | |
PerlMonks |
Re: PERL/Windows file open errorby davido (Cardinal) |
on Mar 04, 2019 at 17:17 UTC ( [id://1230860]=note: print w/replies, xml ) | Need Help?? |
On line 12 (right after my $fn = ...), add this line: warn "Filename: <<<$fn>>>\n";. And observe what comes between the <<< and >>> delimiters. I suspect that you do not have a file named c$template.pks. It may seem like the obvious solution is to change the single quotes to double quotes, but then the backslashes will get interpreted as escapes, and will evaporate. This is one of the joys of dealing with Windows paths that include backslashes. There are two solutions. First, you can just keep it as is but use concatenation:
Or you could use forward slashes, and let Perl sort out with Windows what the path delimiters are:
According to perldoc perlport in the DOS and Derivatives section:
That means under a Windows system you can use forward slashes. This doesn't work if you're exposing the path to the command line shell, but works just fine for system calls such as open. Dave
In Section
Seekers of Perl Wisdom
|
|