Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

if I use chmod() in a script will it port to a system that uses chflags? Also how can I do the following with chmod().
system("/bin/chflags noschg ping"); system("/bin/chmod a-s ping"); # yeah, I have root perms

Replies are listed 'Best First'.
Re: chmod/chflags
by s0ttle (Scribe) on Oct 22, 2001 at 12:26 UTC
    File::chmod- Implements symbolic and ls chmod modes.

    chmod +((stat $file)[2] & 0777), $file;
    should work for both chflags and chmod.

    Update: Added link tags to url
      0777 should be 01777 since a-s does not remove the sticky bit.