#!/usr/bin/perl -w use strict; use POSIX qw{setsid}; ### or just 'use POSIX;' if you plan to use other ### functions from it, of course if ( fork ) { { ### grandparent code goes here print "My grandkid should do a cute l'il ls...\n"; } exit; ### die if we're the parent } if ( fork ) { exit; ### die if we're the parent of this one, too. } ### grandchild code starts here POSIX::setsid; ### should be part of a new session now exec '/bin/ls', '.';