unless (fork) { # this is the child unless (fork) { # this is the grandchild # Do your request processing here ... my $exec = "/usr/local/bin/monster -i$id $filePath$file &"; qx/$exec/; exit 0; } # end grandchild # Child process just exits. exit 0; } # Parent reaps quick-exiting child. wait;