in reply to HELP!! urgent!writing contents toa specific line in an existing file
Use the Tie::File module, which is included in the standard distribution since Perl 5.8.0.
I like the old answer (perl 5.6.x) much better — and much more fitting for solving a homework problem:
Those are operations of a text editor. Perl is not a text editor. Perl is a programming language. You have to decompose the problem into low-level calls to read, write, open, close, and seek.Although humans have an easy time thinking of a text file as being a sequence of lines that operates much like a stack of playing cards -- or punch cards -- computers usually see the text file as a sequence of bytes. In general, there's no direct way for Perl to seek to a particular line of a file, insert text into a file, or remove text from a file.
(etc...)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: HELP!! urgent!writing contents toa specific line in an existing file
by Somni (Friar) on Nov 15, 2007 at 13:18 UTC |