in reply to Permission denied writing to Windows 10

I just did a test on one of my win2k8r2 boxes, and I can reproduce the permission denied error by setting the Read Only flag on the hello.txt file before running the open on it. Could this possibly be your case?

# after setting the RO bit c:\>perl -E "open FILE, '> hello.txt' or die $!" Permission denied at -e line 1.

Note that you should be using 3-arg open, and lexical, not bareword file handles:

open my $fh, '>', 'hello.txt' or die $!;

Replies are listed 'Best First'.
Re^2: Permission denied writing to Windows 10
by Anonymous Monk on Sep 14, 2016 at 18:50 UTC

    Thanks for correcting my use of open. I have changed to use the 3-arg open with lexical handles. Hello.txt as a file does not exist before running the script. The idea is that the script creates file. So if it doesn't yet exist, then it can't be RO, right? Is it possible that files are getting created as RO for some reason?