in reply to Write to filehandle without deleting current text

Do you want to append to your output file? See open.

If you want to change your input file, you shouldn't read and write to the same file at the same time. Write to a different file and rename it after you've made all your changes.

As a third alternative, have you looked at Tie::File? It allows you to treat a file as an array.

  • Comment on Re: Write to filehandle without deleting current text