In the thread at Copying a file to a temporary file, I made the (embarrasing) assumption that rename $oldname, $newname; would fail if a file called $newname already existed.

It came as a complete shock to me that perl's built-in rename will silently delete the existing file if $newname exists.

Two questions

  1. Is this unprecedented for a rename command or function?
  2. Does anyone else think that this is a DWIM too far?

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon