I have two separate processes: a C program that outputs comma separated values followed by a newline every second, and a Perl program that accepts data (in the same format) and processes this data.
The C program outputs (via printf) values as such:
1, 2, 3, 4, 5, 6
7, 8, 9, 10, 11, 12
...
The Perl program sits in an infinite loop waiting on a line basis for STDIN in order to process this data:
while ($line = <STDIN>)
{
chomp($line) # Line should now read "1,2,3,4,5,6"
# Process data
}
I want these two processes to communicate in real time. Standard bash pipes do not work (e.g. process1 | process2) because the Perl program waits for the first program to finish before processing the input.
Does anyone have any ideas, suggestions, or insightd as to a solution to this problem? Thank you in advance!