use Socket; use IO::Handle; use POSIX ":sys_wait_h"; my $childPid; socketpair(CHILD, PARENT, AF_UNIX, SOCK_STREAM, PF_UNSPEC); CHILD->autoflush(1); PARENT->autoflush(1); die "no child fork" unless defined($childPid=fork()); if ($childPid){ shutdown(PARENT,0); print "about to read\n"; while (){ last if (/Are you ready\? > /); print "got $_"; } print PARENT "yes\n"; print "we're ready\n"; } else { print "waiting for pid..\n"; } open(STDOUT, ">&",PARENT) or die "Can't dup stdout: $!\n"; open(STDIN, "<&",PARENT) or die "Can't dup stdin: $!\n"; exec "./fill.pl" or die "Can't start my program: $!\n"; shutdown(CHILD,1); #### #!/usr/bin/perl print < \n"; $a=; if ($a =~ /yes/) {print "bla bla bla";exit 0;} else {goto ASK;}