in reply to Search and Replace line by line not working on Filehandle
In case you were looking for another solution, you could use Tie::File, then loop over the tied array