For a simple solution, read how the -i switch works in perldoc perlrun.
In reply to Re: updating Input file by ambrus in thread updating Input file by Anonymous Monk