I'd like to fork several child processes and read lines from each, for example:

    open my $fh_foo, '-|', 'yes', 'foo' or die $!;
    open my $fh_bar, '-|', 'yes', 'bar' or die $!;
    while (<$fh_foo> OR <$fh_bar>) {               # magic happens here
        say "got a line from one of them: $_";
    }

Is there a CPAN module or well-known recipe that can provide the necessary
magic to poll both filehandles and read a line from either?

If not, I will write something using select() and sysread(), but I wondered
if there was some more convenient way to do it.

-- 
Ed Avis <e...@waniasset.com>


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to