my $exit1 = system "program1"; if ($exit1 == -1) { die "Failed to call 'program1': $!\n"; } $exit1 >>= 8; # Get the real-exit value. The bits we # are shifting off are any possible signals.