in reply to IPC::Open3 confusion
I'm not an expert on IPC3::Open , but here is a trick from the docs which combines STDERR to STDOUT by setting STDOUT to false.
#!/usr/bin/perl use warnings; use strict; use IPC::Open3; #interface to "bc" calculator #my $pid = open3(\*WRITE, \*READ, \*ERROR,"bc"); my $pid = open3(\*WRITE, \*READ,0,"bc"); #if \*ERROR is false, STDERR is sent to STDOUT while(1){ print "Enter expression for bc, i.e. 2 + 2\n"; chomp(my $query = <STDIN>); #send query to bc print WRITE "$query\n"; #get the answer from bc chomp(my $answer = <READ>); print "$query = $answer\n"; }
|
|---|