my $cpid; { defined($cpid = fork) or die $!; $cpid and last; # do child stuff and exit. # exec is good here } # parent goes on, knowing $cpid