Tutorials Point


  Perl Home

  PERL Functions

© 2011 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL syseek Function



Syntax

sysseek FILEHANDLE,POSITION,WHENCE


Definition and Usage

Sets the position within FILEHANDLE according to the values of POSITION and WHENCE.

This function is the 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.

SEEK_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

Return Value

  • undef on failure

  • A position of 0 is returned as the string 0 but true

  • Integer, new position (in bytes) on success



Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names