#!/bin/perl
use FileHandle;   #for autoflush
STDOUT->autoflush(1);

$ppid = `ps -o ppid= -p $$`;
chomp $ppid;
print "My PID is $$ and my parent's PID is $ppid.\n";

$pid = fork();
defined $pid or die "$0: $!";

$ppid = `ps -o ppid= -p $$`;
chomp $ppid;
print "My PID is $$ and my parent's PID is $ppid.  fork returned $pid.\n";

exit 0;
