Copyright © tutorialspoint.com

PERL seek Function


Syntax

seek FILEHANDLE,POSITION,WHENCE


Definition and Usage

Moves to a specified position in a file. You can move relative to the beginning of the file (WHENCE = 0), the current position (WHENCE = 1), or the end of the file (WHENCE = 2). This function is mainly used with fixed length records to randomly access specific records of the file.

For WHENCE you may use the constants SEEK_SET , SEEK_CUR , and SEEK_END (start of the file, current position, end of the file) from the Fcntl module.

This function ius similar to Unix seek() system call.

Return Value

  • 0 on failure

  • 1 on success


Copyright © tutorialspoint.com