sysread FILEHANDLE
, SCALAR
, LENGTH
, OFFSET
sysread FILEHANDLE
, SCALAR
, LENGTH
This function attempts to read LENGTH
bytes of data
into variable SCALAR
from the specified
FILEHANDLE
using
read(2). The function returns the number of bytes
actually read, or 0 at EOF. It returns the undefined value on error.
SCALAR
will be grown or shrunk to the length actually
read. The OFFSET
, if specified, says where in the
string to start putting the bytes, so that you can read into the middle of a
string that's being used as a buffer. For an example, see syswrite. You should be prepared to handle the problems
(like interrupted system calls) that standard I/O normally handles for you.
Also, do not mix calls to read and sysread on the same filehandle unless you are into
heavy wizardry (and/or pain).