Next | Lightweight Databases | 47 |
That's great, but where did the index file come from?
Index files are easy to build:
sub build_index_for_users { 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>) { my $uid = (split /:/)[1]; seek $index_fh, $uid * 10, SEEK_SET; print $index_fh, pack "A10", $pos; $pos = tell $fh; } }
Next | Copyright © 2003 M. J. Dominus |