How can I set file permissions from Perl?

前端 未结 2 1313
挽巷
挽巷 2021-01-17 09:57

I\'m writing a Perl script that generates a Bash script. I\'m using open() with a mode of > to output everything to a new file. Standard stuff:<

2条回答
  •  失恋的感觉
    2021-01-17 10:11

    You will want to chmod the file like this.

    chmod 0755, $filename;
    #or
    chmod 0755, $fh;
    

    Alternatively, if you use sysopen and set the umask appropriately, you can do without chmod.

提交回复
热议问题