in reply to Write to filehandle without deleting current text

{ local $^I = ''; # -i local @ARGV = $fileName; while (<>) { s/foo/bar/g; print; } }