#!/usr/bin/perl use strict; use warnings; use Fcntl; my $FILE = 'foobarbaz'; umask 0; -e $FILE && unlink $FILE; sysopen my $fh, $FILE, O_CREAT, 0777 or die "$!";
I don't think it's possible to do this with open in an atomic manner (please correct me if I'm wrong). open has a built-in mask of 0666. Just open the file normally and chmod it immediately afterwards.
In reply to Re: Creating file with 777 permission
by calin
in thread Creating file with 777 permission
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |