#!/usr/bin/perl -w use strict; launch_child(); $SIG{CHLD}=\&launch_child; sleep 60 while(1); sub launch_child{ print "$$ parent spawning a child\n"; my $pid=fork; if(!$pid){ print "$$ inside the child\n"; # all the code that does the real work is in here # all the other stuff is just a wrapper to keep # this bit going sleep 60 while(1); } }