sub testfork { if (($pid = fork) == 0) { exec("date +'%Y-%m-%d %H:%M:%S' >date.tmp"); } elsif ($pid > 0) { #Parent wait; open (DA, "date.tmp"); $da=; close (DA); unlink ("date.tmp") or die "Cannot unlink date.tmp ($!)" ; print "the date returned from the child process is: $da\n"; } else { print ("Could not fork: errno is $!\n"); } }