#!/usr/bin/perl use strict; my $pid = fork(); die "Can't fork: $!" unless defined $pid; if ($pid > 0) { print "I'm the parent and my pid is $$. My child is $pid\n"; } else { print "I'm the child and my pid is $$. My parent is " . getppid() . "\n"; }