my $pid = fork(); die "Can't fork: $!\n" if ! defined $pid; if ( $pid ) { # parent } else { # child exit; }