>perl -e "use strict; use warnings;use Fcntl; my $fh; sysopen ($fh, 'filefilefile.log', O_WRONLY|O_APPEND ) or die $!" No such file or directory at -e line 1. > > > > > > >ls filefilefile.log ls: filefilefile.log: No such file or directory > > >perl -e "use strict; use warnings;use Fcntl; my $fh; sysopen ($fh, 'filefilefile.log', O_WRONLY|O_EXCL|O_CREAT ) or die $!" > > > > >ls filefilefile.log filefilefile.log > > > ------ Here are examples of open and sysopen in action. To open for reading: open(FH, "<", $path) or die $!; sysopen(FH, $path, O_RDONLY) or die $!; To open for writing, create a new file if needed, or else truncate an old one: open(FH, ">", $path) or die $!; sysopen(FH, $path, O_WRONLY|O_TRUNC|O_CREAT) or die $!; sysopen(FH, $path, O_WRONLY|O_TRUNC|O_CREAT, 0600) or die $!; To open for writing, create a new file, but that file must not previously exist: sysopen(FH, $path, O_WRONLY|O_EXCL|O_CREAT) or die $!; sysopen(FH, $path, O_WRONLY|O_EXCL|O_CREAT, 0600) or die $!; To open for appending, creating it if necessary: open(FH, ">>", $path) or die $!; sysopen(FH, $path, O_WRONLY|O_APPEND|O_CREAT) or die $!; sysopen(FH, $path, O_WRONLY|O_APPEND|O_CREAT, 0600) or die $!; To open for appending, where the file must exist: sysopen(FH, $path, O_WRONLY|O_APPEND) or die $!; To open for update, where the file must exist: open(FH, "+<", $path) or die $!; sysopen(FH, $path, O_RDWR) or die $!; To open for update, but create a new file if necessary: sysopen(FH, $path, O_RDWR|O_CREAT) or die $!; sysopen(FH, $path, O_RDWR|O_CREAT, 0600) or die $!; To open for update, where the file must not exist: sysopen(FH, $path, O_RDWR|O_EXCL|O_CREAT) or die $!; sysopen(FH, $path, O_RDWR|O_EXCL|O_CREAT, 0600) or die $!; We use a creation mask of 0600 here only to show how to create a private file. The argument is normally omitted.