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
In reply to Re: read file line by line then do something and write to same file
by wjw
in thread read file line by line then do something and write to same file
by john.tm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |