Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2016-10-23 22:55 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (302 votes). Check out past polls.