in reply to Search and replace within a file
Take a look at the -i switch, which does in-place file transformations.
Examples are in my presentation A Field Guide To The Perl Command Line.
xoxo,
Andy
In Section
Seekers of Perl Wisdom