sub updateRecord { my ($srml_file,$n,$new) = @_; my ($offset, $data, $post); local $/; # no concurrent access, so no locking open CACHE, "+< $srml_file" or return setError($!); $/ = "\n"; ; # get up to the good stuff $offset = tell CACHE; $/ = "\n"; ; # waste what's there undef $/; $post = ; # get what's left seek CACHE, $offset, 0; truncate CACHE, $offset; # in case new data is shorter print CACHE "\n", getSRML($new), "\n", $post; close CACHE; return -s $srml_file; }