#!/usr/local/bin/perl my $pid = fork(); if ($pid == 0) { # This is the child process. # exec() the external program. exec("./b.pl &") or die "could not exec my_program: $!"; } elsif (!defined($pid)) { die "could not fork"; } # Everything below here is the parent process print "This is the parent process\n"; #### #!/usr/local/bin/perl use Proc::Daemon; Proc::Daemon::init; open ( OUT, ">b.out" ); while ( 1 ) { print OUT `/bin/date`; sleep( 2 ); }