in reply to Re^2: Swapping Files
in thread Swapping Files

I do not know why, but here are some things to look at.

Does printing the value of $! give you any clues?

rename("uaspf.txt", "uaspf.txt.bak") or die"Unable to replace:$!\n";

Alos, take a look at rename because there are portability issues with this function.