- or download this
if (my $pid = fork) { # $pid defined and !=0 -->parent
++$forkcount;
...
close $IN;
defined $pid and exit(0); # $pid==0 -->child, must exit itself
}
- or download this
my $pid=fork() // die "Can't fork: $!";
if ($pid) {
...
} else {
# child code
}
- or download this
my $pid=fork();
defined($pid) or die "Can't fork: $!";