http://www.perlmonks.org?node_id=895444


in reply to replacing string in multi-line text file

From a purely religious point of view, you don't want to update the source file. Rather, you want to create a new file that reflects the changes to the original file. Upon successful completion, you can then rename the original file to something else, and the new file to the original name.

That way, you can always fall back to the source input file and avoid disaster.

  • Comment on Re: replacing string in multi-line text file