in reply to open file for read/write
If you are simply passing through the file editing it then a common Perl idiom is to use inplace edit thus:
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 }
|
|---|