Perl seek Function
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.
Following is the simple syntax for this function −
Following is the example code showing its basic usage −
When above code is executed, it produces the following result −