#!/usr/bin/perl -w use strict; print 'do it? '; my $input = ; print 'doing it, sir', "\n"; forkin(); # make sure child is running and healthy system('ps -ef | grep fork'); # make sure parent can still function print 'if you see this all is well', "\n\n"; exit; sub forkin { my $child; die "Can't fork: $!" unless defined ($child = fork()); if ($child == 0) { # i'm the child! &dummy(); exit; } } sub dummy { # when i had only one op here, child went defunct right # after it completed sub hence the loop. I've used loops # like this before in kids and they still have always # dies with the parent... while (1) { print 'I am the child', "\n"; sleep 3; } } #### "A man's maturity -- consists in having found again the seriousness one had as a child, at play." --Nietzsche