defined(my $pid = open(KID_TO_READ, "-|")) or die "Can't fork: $!"; if ($pid == 0) { # child sleep(5); # Do initialization here print "Done with Init\n"; close(STDOUT); open STDOUT, ">&STDERR"; # Now serve connections # blah blah blah } else { # parent waits for child to init $_ = ; # wait for line or close }