Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: Reference: scalarChapter 5
Function Reference
Next: Reference: seekdir
 

seek

seek filehandle, offset, whence

Positions the file pointer for filehandle, just like the fseek(3) call of standard I/O. The first position in a file is at offset 0, not offset 1, and offsets refer to byte positions, not line numbers. The function returns 1 upon success, 0 otherwise. For handiness, the function can calculate offsets from various file positions for you. The value of whence specifies which of three file positions your offset is relative to: 0, the beginning of the file; 1, the current position in the file; or 2, the end of the file. offset may be negative for a whence of 1 or 2.


Previous: Reference: scalarPerl in a NutshellNext: Reference: seekdir
Reference: scalarBook IndexReference: seekdir

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.