Also see Re: Search Replace String Not Working on text file. You can open a file just once, then truncate and rewrite it. Of course this requires you save your output temporarily in an array. For a 60 mb file, you might want to use @ARGV's special line-by-line in-place editing capability, as also shown in the link. That would save you creating a big array.
In reply to Re: how to avoid opening and closing files
by zentara
in thread how to avoid opening and closing files
by sagar_qwerty
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |