select(STDERR);$|=1;select(STDOUT);$|=1; # autoflush print "This is the prompt: "; my $input = ; print "done.\n"; #### select(STDERR);$|=1;select(STDOUT);$|=1; # autoflush $cmd = 'perl b.pl 2>&1'; system($cmd); #### select(STDERR);$|=1;select(STDOUT);$|=1; # autoflush $cmd = 'perl b.pl 2>&1 |'; open(CMD, $cmd) or die "error: open '$cmd': $!\n"; while () { print } # and print to log file here too close(CMD); #### select(STDERR);$|=1;select(STDOUT);$|=1; # autoflush $cmd = 'perl b.pl 2>&1 | tee -a logfile.txt'; system($cmd);