in reply to updating Input file
For a simple solution, read how the -i switch works in perldoc perlrun.