unless ($temp_f_name eq $renamed_file) { rename($temp_f_name, $renamed_file ) or warn "Couldn't rename: $!\n"; }