smg1827 has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I have an external shell script (which I can’t modify) that returns messages to STDOUT and STDERR at a time.
I want to call this external shell script from my Perl program (which I can modify) and store the return values into two different Perl variables say $sout & $serr. The external script will ALWAYS return to *BOTH* STDOUT and STDERR.
Sample external shell script can be created something like this:
echo "out" >&1
echo "err" >&2
Sample Perl program can be something like this:
($sout, $serr) = callex(…);
I want to see $sout has the value “out” and $serr has the value “err”.
If this can’t be done then please let me know.
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: capture STDOUT, STDERR to TWO different perl variables
by ikegami (Patriarch) on Feb 01, 2011 at 16:23 UTC | |
|
Re: capture STDOUT, STDERR to TWO different perl variables
by Your Mother (Archbishop) on Feb 01, 2011 at 16:48 UTC | |
|
Re: capture STDOUT, STDERR to TWO different perl variables
by fidesachates (Monk) on Feb 01, 2011 at 16:55 UTC |