The sysread keyword[edit | edit source]
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.
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 | edit source]
sysread FILEHANDLE, SCALAR, LENGTH, OFFSET sysread FILEHANDLE, SCALAR, LENGTH
See also[edit | edit source]