use strict; use warnings; my $pid = fork(); die "Fork failed" if not defined $pid; if ($pid) { #parent print "Parent output\n"; } else { #child exec q|perl -e 'sleep(1); print "Child output\n"'|; } wait; print "Parent finishing\n";