Sets FILEHANDLE's system position in bytes using the system call
lseek(2). FILEHANDLE may be an expression whose value gives the name
of the filehandle. The values for WHENCE are
to set the new
position to POSITION,
to set the it to the current position plus
to set it to EOF plus POSITION (typically
Note the in bytes: even if the filehandle has been set to operate
on characters (for example by using the
I/O layer), tell()
will return byte offsets, not character offsets (because implementing
that would render sysseek() very slow).
sysseek() bypasses normal buffered IO, so mixing this with reads (other
sysread, for example
eof may cause confusion.
For WHENCE, you may also use the constants
(start of the file, current position, end of the file)
from the Fcntl module. Use of the constants is also more portable
than relying on 0, 1, and 2. For example to define a "systell" function:
Returns the new position, or the undefined value on failure. A position
of zero is returned as the string
"0 but true"
true on success and false on failure, yet you can still easily determine
the new position.