in reply to Best way to write in Perl
Hi,
Tie::File may be of your choice. It fetches file line-by-line to an array. Whatever you do with the array will reflect in the file like editing, adding or deleting a line. They say :
Tie::File represents a regular text file as a Perl array. Each element in the array corresponds to a record in the file. The first line of the file is element 0 of the array; the second line is element 1, and so on. The file is not loaded into memory, so this will work even for gigantic files. Changes to the array are reflected in the file immediately.
You can push, pop, shift and unshift the array to append, delete from end, delete from beginning and add at beginning. Splice on array can remove a line from array :)
Cheers !
--VC
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Best way to write in Perl
by Anonymous Monk on Sep 04, 2007 at 08:20 UTC |