Cookbook recipe 7.10, as quoted by JJ, has the
virtue that it does not use a temporary file.

If you will allow perl to make use of temporary files
behind the scenes (which is normally perfectly ok),
Cookbook recipe 7.9 is a whole heck of a lot
simpler. As a command line one liner:

    perl -pie 's/a/p/g' try.txt foo.txt

will go thru files try.txt and foo.txt and rewrite them
with every occurence of 'a' replaced with 'p'.

Try it -- you'll like it!

Reply via email to