#!/usr/bin/perl use strict; my @array = qw(a b c d e f g h); my @childs; for (1 .. 10) { my $pid = fork(); if ($pid) { push (@childs, $pid); } else ($pid == 0) { print "@array\n\n"; sleep 10; exit (0); } print "Running another child process - $pid.\n"; } print "All child processes have been ran.\n"; print "@childs\n"; foreach (@childs) { waitpid ($_, 0); } print "All child processes are finished.\n";