in reply to updating a file

Little-known fact: the "-i" flag just sets the $^I variable. You can set it yourself. Then setting @ARGV, reading <>, and printing the result is all you have to do. Thus:

local $^I = '.bak'; local @ARGV = ("$dir/$header_file"); while (<>) { s/foo/bar/; # whatever you want print; }

Presto, magico, all done!

    -- Chip Salzenberg, Free-Floating Agent of Chaos

Replies are listed 'Best First'.
Re: Use $^I (was Re: updating a file)
by Anonymous Monk on Nov 29, 2001 at 03:15 UTC
    nice work. impressed. I knew there would be an easier solution. Thanks. :-)