exec will never return if the command succeeds. Otherwise, it will return and store the error message in $!. You ought to include this in your warn to aid your debugging:
exec('qtar', "-g $path $file -L FULL -R >>$LOGFILE") or warn "Couldn't exec: $!";
If you do need to modify your environment, add and modify keys of the special %ENV hash, like so:
$ENV{path} .= '/usr/local/myneatprogram/bin';
$ENV{qtar_args} = '-C';
Those are made-up examples. |