in reply to Re: general perl question
in thread In-place editing of files (was: general perl question)

mirod's reply is probably what you want.

If you'd like to do this in a program, set the $^I variable (same thing as -i on the cmd line) to .bak or whatever. Or don't set it, and you'll just write over the file. Make sure @ARGV is set to the file name(s), either via the cmd line or in the program.