in reply to Modifying entries in a file.

You may want to look at Tie::File, which will handle the file reading and writing for you, and leave you to work on a simple array. If not, you'll have to write out the unchanged file contents yourself, as well as the stuff you're actually changing. You'll also have to change your existing open statement, as you're currently going to be truncating the contents of $ModFile when you hit that line which is probably not what you want ;-)

Hope that helps