in reply to How to delete a particular line in a text file after some operation on that text file at the same time
Hello ppp,
Please see the entry “How do I change, delete, or insert a line in a file, or append to the beginning of a file?” in perlfaq5. Note the following:
The basic idea of inserting, changing, or deleting a line from a text file involves reading and printing the file to the point you want to make the change, making the change, then reading and printing the rest of the file. Perl doesn't provide random access to lines...
Once the new file has been written successfully, delete the original and rename the new file using either the builtin rename function or the move function from File::Copy.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to delete a particular line in a text file after some operation on that text file at the same time
by ppp (Acolyte) on Jan 18, 2015 at 04:21 UTC | |
by Athanasius (Archbishop) on Jan 18, 2015 at 04:33 UTC | |
by ppp (Acolyte) on Jan 18, 2015 at 05:36 UTC | |
by ppp (Acolyte) on Jan 18, 2015 at 05:08 UTC | |
by soonix (Chancellor) on Jan 18, 2015 at 06:48 UTC | |
by james28909 (Deacon) on Jan 18, 2015 at 06:25 UTC |