#!C:/Activeperl/bin/perl.exe use strict; use warnings; open (IN, "fork2.ini") or die("Can't open input file $!\n"); my $pid=0; my $x=0; while (my $computer=) { chomp($computer); $x++; $pid = fork(); if ($pid) { print STDERR "Parent $$ got PID $pid from fork($$ $computer)\n"; sleep(1); }else { print STDERR "\t$$ $computer\n"; exit(0); } if($x > 4) { do { $pid=wait() } while ($pid != -1); $x=0; } } do { $pid=wait() } while ($pid != -1); print "wait() ed until $pid was returned.\n"; close(IN); __DATA__ Computer1 Computer2 Computer3