in reply to Conditional replace

The s/// operator returns the number of substitutions.
So something like: do_something() if s/foo/bar/; should do the trick.