# mostly from the camel book if ($pid = fork) { .... #parent } elsif (defined $pid) { ... #child exit; }