#!/usr/bin/perl use strict; use warnings; use IO::Handle; use IPC::Open3; my $fh_out = new IO::Handle; my $fh_in = new IO::Handle; my $fh_err = new IO::Handle; my $pid = open3($fh_in,$fh_out,$fh_err,'./skript_above.pl'); $fh_out->autoflush(1); #Putting these lines above open3 $fh_err->autoflush(1); #doesn't seem to work either while (!$fh_out->eof) { my $line = $fh_out->getline; print "TIME: ".localtime()." OUTPUT: ".$line; if ($line =~ m/^Please press return/ ) { $fh_in->print("\n"); #provide the desired input } } waitpid($pid,0);