Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: chmod in perl

by atcroft (Monsignor)
on Mar 11, 2011 at 04:33 UTC ( #892584=note: print w/replies, xml ) Need Help??

in reply to chmod in perl

Have you checked the return status of the chmod command? For instance,

my $filename = q{deletefiles.txt}; chmod 0777, $filename or die $!; open my $OUTPUT, q{+>}, $filename or die $!;

Hope that helps.

Update: 2011-03-11

Fixed missing semicolon on line 2 of code example causing error referred to in Re^2: chmod in perl.

Replies are listed 'Best First'.
Re^2: chmod in perl
by Anonymous Monk on Mar 11, 2011 at 06:18 UTC

    I am getting the following error with the above code

    my $filename = q{deletefiles.txt}; chmod 0777, $filename or die $! open my $OUTPUT, q{+>}, $filename or die $!; Missing comma after first argument to die function at line 135 +, near "$filename or" Execution of aborted due to compilation errors.
      You miscopied the code.

        Actually, I did. I fixed it, and put a note at the bottom to indicate it had been updated, but have no idea if the OP has seen it or tried with the missing semicolon in place.

      Try and put the semicolon after first die statement. Because of that its throwing that error because it's gonna continue till the end of file if you dont specify where to exactly end.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://892584]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2017-04-26 06:28 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (468 votes). Check out past polls.