if ( my $pid = fork() ) { my $pid_of_child_that_finished = wait(); my $status_code_of_child = $?; # or $CHILD_ERROR_NATIVE } elsif ( defined $pid ) { exec( '/bin/ls' ); } else { warn "Something broke: can't fork()!\n"; } # continue processing in the parent after child is done