my $output = qx("$command 2>&1"); if ($?) { # something wrong }