--- name: sysread status: documented runtime: pp source: src/runtime/pp/fileio.rs --- ```{index} single: sysread; Perl built-in (pp runtime) ``` # sysread ## Synopsis ```perl $n = sysread($fh, $buf, $length); $n = sysread($fh, $buf, $length, $offset); ``` ## Description Performs an unbuffered read directly from the OS file descriptor. Reads up to LENGTH bytes from the filehandle into BUFFER using the underlying `read(2)` system call, bypassing Perl's buffered I/O layer. When OFFSET is given, data is placed starting at that byte position within the buffer. Returns the number of bytes actually read (which may be less than LENGTH), 0 at end-of-file, or `undef` on error (with `$!` set to the OS errno). **Warning**: Do not mix `sysread` with buffered I/O (`read`, `readline`, `<>`) on the same filehandle. ## See also read, syswrite, sysseek