Exit status of child spawned in a pipe <p>Simple question but I cannot find a good answer - here goes with an example:</p> <p>"world.pl" spawns "hello.pl" in a child and processes its stdout. "world.pl" needs to know the exit status of "hello.pl". Making a system call is not an option, since "world.pl" needs to process the stdout of "hello.pl". I am also trying to avoid fork(). Question: How can "world.pl" find the exit status of "hello.pl"? Using perl v5.12.4 on Darwin, if it matters. Thanks in advance, - M.</p> <pre><code>#!/opt/local/bin/perl -w ## hello.pl &lt;name&gt; [more names] exit 1 if ($#ARGV &lt; 0); foreach (@ARGV) { print "Hello, $_\n" } exit 0; </code></pre> <p>The other part ...</p> <pre><code>#!/opt/local/bin/perl -w ## world.pl name [more names ...] open (FP, "./hello.pl @ARGV |") or die "$0: Cannot open pipe: $!\n"; while (&lt;FP&gt;) { print } close FP; my $status = 0; # Want this to be exit status of the process "hello.pl" exit $status; </code></pre>