Yes, please post a snippet and what OS you're on. If you're moving from one filesystem to another, rename
may fail. rename is very OS (well filesystem) intrinsic. Are you checking the return value of rename?
rename "/foo/bar.txt", "/bar/foo.txt" or
die "could not rename $!\n";