# once again, adapted from perlipc
use vars qw( %status ); # our, if you prefer
sub REAPER {
$waitedpid = wait;
# now status is in $?
$status{ $waitedpid } = $? >> 8;
# loathe sysV: it makes us not only reinstate
# the handler, but place it after the wait
$SIG{CHLD} = \&REAPER;
}
$SIG{CHLD} = \&REAPER;
while ( my ($k,$v) = each %status ) {
print "pid $k\tstatus $v\n"
}