| Next | Tricks of the Wizards | 37 |
$fh->remember('hippo') will save the current position under the key hippo.
sub remember {
my ($self, $key) = @_; # $self is a GLOB reference
*$self->{$key} = tell $self;
}
$fh->gobackto('hippo') will return to the saved position.
sub gobackto {
my ($self, $key) = @_;
seek $self, *$self->{$key}, 0;
}
Future reads from the `filehandle' will continue from the old position
| Next | ![]() |
Copyright © 2003 M. J. Dominus |