use Fcntl qw< O_CREAT O_RDWR >; sysopen my $fh, $filename, O_CREAT()|O_RDWR(), 0666 or die "Can't open $filename: $!\n";