Don't use the same filehandle for reading and writing. One solution is to write what you want to a temporary file, then when you're done you can rename the temporary file to the original name.
Or try Tie::File.
In reply to Re: text file search and replace
by Narveson
in thread text file search and replace
by igotlongestname
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |