Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: chmod in perl

by atcroft (Abbot)
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]
[Discipulus]: covfefe.. ? ;=)

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2018-06-22 08:20 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (122 votes). Check out past polls.