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


in reply to Re^2: A DWIM too far?
in thread A DWIM too far?

That may not work for directories.

But I think that idiom justifies Unix's choice of rename behavior. If rename failed when a new file already exists, there isn't good way to code a rename-that-overwrites.