local @ARGV = ('nameOfFileToEdit'); local $^I = '.bak'; # extension for backup version of file while (<>) { #line read is in $_ print "new state of line\n"; # write updated line }