in reply to Search and Replace.

To see if it's file IO that's slowing you down, compare the runtime of this snippet with your original:
while (<IN_FILE>) { print OUTFILE $_; }
If there's no significant difference, then you're optimizing in the wrong place :(

-QM
--
Quantum Mechanics: The dreams stuff is made of