http://www.perlmonks.org?node_id=471507


in reply to Re^4: Writing to a file atomically without renaming
in thread Writing to a file atomically without renaming

Your cat must be different than mine..( a cat of a different color?) my "cat backup_file > file" won't destroy both the backup_file and the main file in the event that the backup_file was unable to overwrite the file. A simple diff between the two before removing the backup file is all that would be needed.