print "process id: $$\n"; my $pid = fork; my $FH; unless($pid){ setpgrp; exec('script'); } print "Child process id is: $pid\n"; while(1) {sleep(5)} #### use POSIX; while(1) { sleep(1); print "I am running\n"; my $pid = fork; unless($pid) { while(1) { sleep(2); print "I am child and I'am running\n"; } } }