$ cat 6.fork.pl #!/usr/bin/perl -w use 5.011; my $start = time; if (fork() == 0) { # arm the alarm clock alarm(10); # create a child process that sleeps system("ping www.google.com >5.fork.txt"); exit(0); } say "relevant processes with pstree command:"; system("pstree -Apal $$"); while((my $pid = wait()) != -1) { say "$pid terminated" } system("cat 5.fork.txt"); say time-$start, " ? <-ten seconds elapsed from forked process" __END__ $