Next | Lightweight Databases | 19 |
seek adjusts the current position of a filehandle
use Fcntl ':seek'; # For SEEK_SET etc.
Absolute position:
seek FH, $position, SEEK_SET;
Relative position:
seek FH, $position, SEEK_CUR;
Relative to the end of the file:
seek FH, $position, SEEK_END;
tell returns the current absolute position:
my $position = tell FH;
# read, write, and seek FH here ...
seek FH, $position, SEEK_SET;
This is guaranteed to put the handle back where it was at the time of the tell
Next | Copyright © 2003 M. J. Dominus |