A simple way to do this would be to use Tie::File. It is one of the core modules in the Perl distribution, so you would not have to install anything extra. Here is a snippet from a script I wrote using Tie::File:
tie @ThisFile, 'Tie::File', 'c:/index.html';
foreach(@ThisFile) {s/$SearchText/$ReplaceText/g};
untie @ThisFile;