in reply to Correct code for deleting old file?
I would not delete the old file but rename it (or move it somewhere else) so that you can fall back on it.
You can rename or more a file with the move-function from File::Copy.