in reply to updating a file

While you've got the right idea by open()ing the file in read/write mode, it doesn't work quite as one would hope. You may want to try using the inplace command line switch like so
perl -pi -e 's/search_re/replace_re/g' $your_files_here
For more info on those lovely little switches check out the manual. Also you may want to be a little (see. A LOT) cautious of the infamous dot-star (i.e .*). You can learn of it's dodgy dealings from Ovid here.
HTH

broquaint