Perl sysseek Function
This function sets the position within FILEHANDLE according to the values of POSITION and WHENCE.
This is equivalent of the C function lseek( ), so you should avoid using it with buffered forms of FILEHANDLE. This includes the "FILEHANDLE" notation and print, write, seek, and tell. Using it with sysread or syswrite is OK, since they too ignore buffering.
The position within the file is specified by POSITION, using the value of WHENCE as a reference point, as shown below in Table.
EEK_SET -> 0 Sets the new position absolutely to POSITION bytes within the file SEEK_CUR -> 1 Sets the new position to the current position plus POSITION bytes within the file SEEK_END -> 2 Sets the new position to POSITION bytes, relative to the end of the file
Following is the simple syntax for this function:
This function returns undef on failure, a position of 0 is returned as the string 0 but true and Integer, new position (in bytes) on success.
Following is the example code showing its basic usage:
When above code is executed, it produced following result