August 1999 | Return to the Perl Hardware Store | Slide #13 |
I promised a remember operation
$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 © 1999 M-J. Dominus |