I looked at PerlFaq5 and modified that code a little.
In reply to Re: In-place file manipulation by AcidHawk in thread In-place file manipulation by ibanix