if ((my $pid = fork()) < 0){ #error } elsif ($pid > 0) { #parent } else { $child }