in reply to Find and Replace script

Assuming that this is a utility script to globally update a web site, and will not be run by visitors. I would go with your first inclination and use File::Find to walk the directory, and complete the operation in one call to the cgi script. Just print some feedback to the browser (even a single space should do) after each file update and you will not have to worry about timing out. I've used this technique often for long running cgi utility scripts. Just be sure to print a completion message so you know when the job is done.