This is a very basic question but I don't find the answer by googling it. I'm doing in a php program a simple call to perl to find and replace strings in many files:
exec("perl -pi -e 's|foo|bar|g' `find . -name *.foo`");
and I would like the command to return the number of replacements. Anyone knows how to do that? Thank you.