Perl Programming/Keywords/sysread

Previous: sysopen Keywords Next: sysseek

The sysread keyword edit

The sysread function tries to read LENGTH number of bytes from the FILEHANDLE into the SCALAR by using read(2) of UNIX.

sysread returns the new position on success and undef otherwise. For performance reasons, even if the FILEHANDLE has been set to operate on characters, the function tell() will return the byte offsets.

Do not use sysread with reads or with eof, print, seek, tell, or write, as it bypasses normal buffered I/O.

An OFFSET to place the read data this number of bytes away from start. If OFFSET is less than zero, it places the data this number of bytes before the end of the string. If OFFSET is greater than the string length, \0 bytes are padded before appending the data.

If the FILEHANDLE has been marked as :utf8 Unicode, characters are read instead of bytes, and the return value of sysread() is in Unicode characters.

Syntax edit


See also edit

syscall sysopen sysread sysseek system syswrite
Previous: sysopen Keywords Next: sysseek