my $output = `batch_file args && exit /b ERRORLEVEL`; die "Gone horribly wrong - $?" if $?; # or ... my @output = `batch_file args && exit /b ERRORLEVEL`; die "Gone horribly wrong - $?" if $?;