in reply to
Re^2: comparing file contents
in thread comparing file contents
Yes, it could be achieved by opening the file in read+write mode, or by re-opening the file in write mode after its read-only filehandle was closed. However, either of these methods would require other code changes, to hold all the lines of output until after all the input had occurred.
The simplest way is to append this code to the bottom of my previous code:
or die "Could not delete '$in_path': $!";
move( $out_path, $in_path )
or die "Could not move file '$out_path' to '$in_path': $!";