| Next | Lightweight Databases | 42 |
Searching takes just as long as with variable-length records
The win is when we want to modify a record
sub modify_user_data {
my ($fh, $user, @newdata) = @_;
unless (find_user($fh, $user)) {
seek $fh, 0, SEEK_END; # Move to end of file
}
print $fh pack "A8 A5 A13 A20 A18", $user, @newdata;
}
Before, modifying was difficult in general
The only easy way was to copy the entire file
Now modifying in-place is cheap
| Next | ![]() |
Copyright © 2003 M. J. Dominus |