#!/usr/bin/env perl use 5.014; use strict; use warnings; my $pid = fork; if (!defined $pid) { die "Cannot fork: $!"; } elsif ($pid == 0) { # client process say "Client starting..."; sleep 10; # do something useful instead! say "Client terminating"; exit 0; } else { # parent process say "Parent process, waiting for child..."; # do something useful here! waitpid $pid, 0; } say "Parent process after child has finished";