Perl seek Function



Description

This function 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 is similar to Unix seek() system call.

Syntax

Following is the simple syntax for this function −

seek FILEHANDLE,POSITION,WHENCE

Return Value

This function

perl_function_references.htm
Advertisements