system("mv $from $to");
as in your first post, a shell will be started which in turn will call the external mv program with the three cmd line arguments foo, bar and baz. (Well, upon a closer look to the docs it seems that it will call the shell only if there are shell metacharacters, but the final result won't change.) This may not be your case, but it serves as an instructive example. Alternatively use the LIST form of system, which will avoid the shell in any case and more likely do the Right Thing™ - and check its return value:
0 == system 'mv', $from, $to or warn "Something wrong: $?\n";
|