| Next | Lightweight Databases | 50 |
Sometimes the index number is just the record number:
sub build_index_for_text {
my ($fh, $index_fh) = @_;
seek $fh, 0, SEEK_SET;
seek $index_fh, 0, SEEK_SET;
truncate $index_fh, 0; # Discard old index
my $pos = tell $fh;
while (<$fh>) {
print $index_fh, pack "A10", $pos;
$pos = tell $fh;
}
}
| Next | ![]() |
Copyright © 2003 M. J. Dominus |