You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
programming-examples/perl/CGI/Distinguish between the par...

14 lines
323 B
Perl

# If fork returns 0, the current process is the child and not the parent.
# If an error occurs, fork returns a special undefined value called undef.
$pid = fork();
if ($pid == 0) {
# We're in the child process.
} elsif (! defined $pid) {
# Not defined: means an error.
} else {
# Parent process.
}