#!/usr/bin/perl use warnings; use strict; my $pid = open(F,"-|"); if (!defined($pid)) { die "fork error: $!\n"; } if ($pid) { # Parent print "PARENT: PID is $$\n"; sleep(1000); print ; close(F); } else { # Child exec("/bin/bash","-c", 'echo CHILD: PID is $$, PPID is $PPID >&2'); }