Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Permission denied writing to Windows 10

by ww (Archbishop)
on Sep 14, 2016 at 20:48 UTC ( [id://1171777]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Permission denied writing to Windows 10
in thread Permission denied writing to Windows 10

What is the full path? WinDoze got picky about writing to "\Program Files\whatever...." some time ago. Running as Admin doesn't always override that.

Writing to C:\Public, on the other hand, is unlikely to give you problems, but whatever the issue may be, you'll be well served to create a new directory, on another (local) drive if that's available in which to put your new work. Commingling your Perl install with homework, experiments, learning-challenges and other scripts will be a hassle a few weeks or months from now.

Just BTW, as this has already been partially addressed by way of correction, but I don't know how the open shown in your OP could work, period, given the missing close-quote, comma operator, space, open-quote sequence. Of course, sometimes I miss the memo... and I did not test your version because I expected a syntax error.

Update: Please don't read the preceding paragraph. Pretty Please? See Rev. Canon AnomalousMonk's reply below. Watch ww flush with embarrasment! Mea Culpa.

Replies are listed 'Best First'.
Re^4: Permission denied writing to Windows 10
by AnomalousMonk (Archbishop) on Sep 14, 2016 at 21:12 UTC
        open FILE,"> hello.txt" or die $!;

    ... I don't know how the open shown in your OP could work, period, given the missing close-quote, comma operator, space, open-quote sequence.

    That's the old, disparaged, denigrated, frowned-upon, but not deprecated two-argument form of open. The file-access specifier is fused with the file name in a single string. IIRC, the space between the  '>' write-access specifier and the file name is just the sort of gateway (among others) to a potential pitfall that the three-argument open was designed to avoid. Yes, it works.


    Give a man a fish:  <%-{-{-{-<

Re^4: Permission denied writing to Windows 10
by Anonymous Monk on Sep 14, 2016 at 22:33 UTC

    Thanks for the advice. I am indeed going to just move my stuff to a different directory that seems to work.

    As for the code in the OP, it actually does work. One of the good (and bad) things about Perl is that it is so forgiving of lazy coding. Consider me properly admonished!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1171777]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-04-19 09:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found