http://qs1969.pair.com?node_id=652588


in reply to Newbie: uses/limits of perl in editing files

Tie::File is nice for stuff like that.

It makes the file look like an array, with one line in each element. Then you modify the array. As you do, the changes appear in the file.