my $PID = fork(); if ($PID) { # in the parent process } else { # in the child process } #### my $PID = fork(); if ($PID) { # in the parent process } else { # in either the child process or the parent # process, depending on whether the fork() # succeeded or failed. }