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