FORK: { if ($pid = fork) { #Parent here. #Child process pid is available in $pid } elsif (defined $pid) { #pid is zero here if defined #child here #parent process pid is available with getppid (Not available with Windows). } elsif ($! == EAGAIN) { #EAGAIN is supposedly recoverable fork error sleep 5; redo FORK; } else { #Weird fork error die "Can't fork: $!\n"; } }