in reply to Extracting data from file and modifying without making change in file.
Strange as it may seem, updating a file “in place” is very often really not what you want to do, for two reasons:
If you make frequent modifications of the same kind to the data in a file, consider using a template-driven approach to the problem. Packages like Template::Toolkit are most commonly used to build web pages, but they can do other things too.