in reply to Killing Parents and Children

Hmm, there is no way of killing both parent and children without 'killing the program itself'. In fact, once you fork, there are multiple instances of the program itself running.

If you want to kill off children after a certain time, simply make use of the child PID returned by fork:

#!/usr/local/bin/perl -w use strict; my @child; for (0..5) { print "Spawning child $_\n"; $child[$_]=spawn(sub {while (1) {}}); } sleep 5; for (0..5) { print "Killing child $_\n"; kill 15, $child[$_]; } sub spawn { my $code=shift; #die "Something fishy - could not fork\n" if ((my $pid = fork())== - +1); # Oops - wrong fork() semantics die "Something fishy - could not fork\n" unless (defined(my $pid=for +k())); return $pid if ($pid); exit &$code; }

Update: I was stuck in C - see comments in code :)

CU
Robartes-