in reply to system function

Not that this is perl related, but if you're executing the move command mv with the same file as both arguments, mv should fail with an error message. Your first invocation of system() should execute the command just as if you had typed it into the shell. Which can be dangerous -- if you're using the -T switch for taint checking, the first version of system will cause your program to die if the value of $file is obtained from outsite the source code of your script (from a command line argument, or from a file including stdin). The second invocation of system() should be much safer, as the array invocation of system() executes the first argument, and any remaining arguments are passed directly to the program being executed. As already asked, what is the output of the program when you run it?