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

syswrite

Performs an unbuffered write directly to the OS file descriptor.

Writes data from SCALAR to the filehandle using the underlying write(2) system call, bypassing Perl’s buffered I/O layer. When LENGTH is specified, at most that many bytes are written. When OFFSET is given, writing starts from that byte position within the scalar.

Returns the number of bytes actually written, or undef on error (with $! set to the OS errno).

Warning: Do not mix syswrite with buffered I/O (print, say) on the same filehandle.

Synopsis

$n = syswrite($fh, $scalar);
$n = syswrite($fh, $scalar, $length);
$n = syswrite($fh, $scalar, $length, $offset);

See Also

sysread, sysseek, print