I face the problem of not getting the complete input when reading from STDIN when using select and <STDIN>.
Usage: prompt>A.pl | B.pl
I have script A output piped to Script B. And I use select call to find out when there is input in the STDIN and then call my $input=<STDIN> when select says that there is data to read.
The problem that is faced is that the last 2 lines or sometimes last line is not coming up in the script B. There is no problem with the Script A, since the command
A.pl | cat prints all the lines.
The problem is only with Select and STDIN. Select doesn't recognize the last line of the input and doesn't say that the STDIN is ready for reading even though data is present.
I modified the script in such way that I commented out all select portions and instead had while(1) { my $input=<STDIN>}, the program gets blocked, but it gets the entire input.
Any help will be greatly appreciated.