perl -pe '/foo/ and $_ = "This line was changed ($_)"'