read#
Read up to $nbytes bytes from $fd into $buffer.
Synopsis#
use POSIX qw(read);
my $buf = "";
my $n = read($fd, $buf, 4096);
What you get back#
On success, the number of bytes read (or "0 but true" for EOF);
on failure, undef (with $! set). The data is written into
$buffer in place — truncated or grown to match the actual read
length.
Edge cases#
Partial reads are normal on pipes, sockets, and terminals; always check the return length.
Differences from upstream#
Fully compatible with upstream POSIX.