sub changeme{ local $^I = ".$bak"; @ARGV = "somefile"; while (<>) { s/foo/bar/i; print; } }