I open a pipe to a program:
open(PIPEWRITE, '|./program') or die "Can't start pipe: $!"; print PIPEWRITE for @array; close PIPEWRITE or die "Cant't close pipe: $!";
[download]
But how do I read the output of my pipe? I dont want to store it to a file like this
open(PIPEWRITE, '|./program > output');
[download]
Because I am doing several thousand executions. How can I store the ouput to an array?

Solution:

use IPC::Open2; my $pid = open2(\*RDRFH, \*WTRFH, './program'); print WTRFH @{$mail[0]}; close WTRFH; waitpid $pid, 0; my @array = <RDRFH>; close RDRFH;
[download]
http://www.perlmonks.org/index.pl?node_id=407972 would also work