Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

sysopen

Opens a file using POSIX open(2) flags for precise mode control.

Unlike the high-level open, sysopen takes explicit POSIX mode flags (from Fcntl) and an optional permissions mask. The flags are passed directly to the underlying open(2) system call.

Arguments on the stack (via mark): filehandle target, filename, mode flags, and optional permissions (defaults to 0666, modified by umask).

Returns 1 on success (the filehandle is stored in the first argument) or undef on failure.

Synopsis

use Fcntl;
sysopen(my $fh, $filename, O_RDWR | O_CREAT, 0644);
sysopen(FH, $path, O_WRONLY | O_TRUNC);

See Also

open, close, Fcntl