... eval { IPC::Run::run \@cmd, '>>', $outfile, '2>&1'; }; if($@) { # Could not run the program $fail_to_run=$@; $exitcode=undef; } else { $fail_to_run=undef; $exitcode=$? >> 8; }