Next | Lightweight Databases | 66 |
$FILE[$n] =~ s/this/that/;
Tie::File knows how long each record is
If you replace a record with one of the same length, it overwrites in place
If the lengths differ, it must rewrite the tail of the file
It uses a block copy algorithm for this
Truncating the file is easy:
$#FILE = 12;
This locates the end of record 12 (if necessary) and truncates the file accordingly
The general problem is very complicated and interesting
New improvements are always coming
Next | Copyright © 2003 M. J. Dominus |