in reply to read file line by line then do something and write to same file
Take a look at the Tie::File module. If you examine how it works, you will see how this is done.
Generally, one reads a file into some data structure (an array being the most simple) then unlinks the original file(deletes it) then create and write back to a nee file of the same name.
A google search will bring you right back here to read from a file and write into the same file which examines the methods and it's whys and wherefores.
Hope that is helpful...
...the majority is always wrong, and always the last to know about it...
Insanity: Doing the same thing over and over again and expecting different results...
A solution is nothing more than a clearly stated problem...otherwise, the problem is not a problem, it is a facct
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: read file line by line then do something and write to same file
by davido (Cardinal) on Jun 15, 2014 at 22:56 UTC | |
by wjw (Priest) on Jun 15, 2014 at 23:59 UTC | |
by oiskuu (Hermit) on Jun 16, 2014 at 19:36 UTC | |
by davido (Cardinal) on Jun 16, 2014 at 19:44 UTC |