#!/usr/bin/perl use 5.010; use strict; use warnings; $|=1; my $num=20; #oder eine beliebige andere Zahl my @childs=(); for (1..$num) { my $pid=fork(); die "Fehler: $!\n" unless(defined $pid); if ($pid==0) { #kindprozess print "Hier ist Kind Nr. $_\n"; sleep(5); exit(0); } else { push(@childs, $pid); } } print "Alle Kinder gezeugt\n"; for (@childs) { waitpid($_, 0); print "Kind $_ gestorben\n"; }