Sara wrote: > open (DB, "+<test.db"); > > truncate (DB, 1024); > > close DB; > > > > 1. This truncate the file from bottom .......... Is there a way the > file can truncated from the top?
No. You have to rewrite the file contents to delete from the beginning of the file. > > 2. I have DB with 4-8 digits number in each line e.g. > > 1238483 > 92933 > 09983433 > 093 > > The truncate function truncates the file very abruptly .... for > example the last line 093 after truncate will be left 0 . Well, you have to truncate in the right place :-) > > Is there a way that it should remove the last full line \n? rather > leaving 1 or 2 digits behind. truncate() is a pretty low-level tool. It doesn't deal with lines and such; just byte offsets. You can investigate the Tie::File module which can deal with both of the issue you raise. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]