perl scripts stdin/pipe reading problem [closed]
- by user4541
I have 2 scripts for a task.
The 1st outputs lines of data (terminated with RT/LF) to STDOUT now and then.
The 2nd keeps reading data from STDIN for further processing in the following way:
use strict;
my $dataline;
while(1) {
$dtaline = "";
$dataline = ;
until( $dataline ne "") {
sleep(1);
$dataline = ;
}
#further processing with a non-empty data line follows
#
}
print "quitting...\n";
I redirect the output from the 1st to the 2nd using pipe as following: perl scrt1 |perl scpt2.
But the problem I'm having with these 2 scpts is that it looks like that the 2nd scpt keeps getting the initial load of lines of data from the 1st scpt if there's no data anymore.
Wonder if anybody having similar issues can kindly help a bit?
Thanks.