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. #### my $exit2 = system "program2", $exit1; if ($exit2 == -1) { die "Failed to call 'program2': $!\n"; }