You're creating problems by invoking the shell -- so stop invoking the shell. The sensible solution to this
specific problem is to use File::Copy's
move method to move the file instead of shelling out to mv.
The solution to the general problem of running external commands without the shell getting in your way is to use the LIST forms of system and open instead of using single-arg system, single-arg open, or backticks. But that's just for future reference, because you don't need an external command to rename/move a file.