Howdy list :)

I'm having a bit of a time with combining 2 read filehandles.

Let me explain,


use strict;
use warnings;
use IPC::Open3;

my ($write_fh, $read_fh, $error_fh);
open3($write_fh, $read_fh, $error_fh, ...

while(<$read_fh>) {
 ...
}

while(<$error_fh>) {
...
}

works fine, great..

What I'd like to do is process $read_fh and $error_fh in the order they actually happen ( which is what open3($write_fh, $read_fh, $read_fh, ... does ) but still have the error handle available afterward to look upon specifically.

use strict;
use warnings;
use IPC::Open3;

my ($write_fh, $read_fh, $error_fh);
open3($write_fh, $read_fh, $error_fh, ...

while(magically_read_both_in_order_that_the_command_puts_them_out($read_fh, $error_fh)) {
 ...
}

while(<$error_fh>) {
...
}


So that the first while loop will see:

blah 1
blah 2
oops
blah 3
blah 4
blah 5
oops again

and the second will see

oops
oops again

and not like the first example which will be:

blah 1
blah 2
blah 3
blah 4
blah 5

then

oops
oops again

Any ideas or pointers on it would be great, my head is about to explode :)

TIA!

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to