| Public Scratchpad | Download, Select Code To D/L |
But how do I read the output of my pipe? I dont want to store it to a file like thisopen(PIPEWRITE, '|./program') or die "Can't start pipe: $!"; print PIPEWRITE for @array; close PIPEWRITE or die "Cant't close pipe: $!";
Because I am doing several thousand executions. How can I store the ouput to an array?open(PIPEWRITE, '|./program > output');
Solution:
http://www.perlmonks.org/index.pl?node_id=407972 would also workuse IPC::Open2; my $pid = open2(\*RDRFH, \*WTRFH, './program'); print WTRFH @{$mail[0]}; close WTRFH; waitpid $pid, 0; my @array = <RDRFH>; close RDRFH;