open#
Open a file by path, returning a raw file descriptor.
Synopsis#
use POSIX qw(open O_RDONLY O_CREAT O_WRONLY);
my $fd = open($path, O_RDONLY)
or die "open: $!";
What you get back#
A non-negative integer fd on success, undef on failure (with
$! set). This is the raw system fd, not a Perl filehandle —
pair it with POSIX::close or convert via IO::Handle::fdopen.
Differences from upstream#
Fully compatible with upstream POSIX. Third argument $mode
defaults to 0666 when opening with O_CREAT and no mode given.
See also#
close,dup,lseek,read,write— the rest of the raw fd API.Core
open— the Perl-native filehandle interface.