in reply to Perl Matching with text file

take a look at perldoc perlrun for the -i option as well as the -p and -e options. Basically you can do this directly from the command-line with perl like this:
perl -i.bak -pe 's/foo/bar/' somedir/*.ext