programming-examples/perl/SystemFunction/fork returns the child's process ID.pl
2019-11-15 12:59:38 +01:00

16 lines
335 B
Perl

#!/usr/bin/perl
use warnings;
use strict;
my $f = fork; # Program splits in two here
if (defined $f) {
if ($f == 0) {
print "This is the child process\n";
exit;
} else {
print "This is the parent process\n";
exit;
}
} else {
print "Your system doesn't support fork!\n";
}