in reply to IO::Select woes

Not sure the other answers completely explained what is wrong, but: When you pipe them - both are executed and start at the 'same time' with ones output piped to the others input. This the second test.pl can start before the first has even output anything.

The fix is to execute test.pl while capturing its output. Then when that has finished, execute again with the captured output.

perl test.pl > temp_file perl test.pl < temp_file
Or some terminals you may be able to do this in one line:
perl test.pl > temp_file && perl test.pl < temp_file

Replies are listed 'Best First'.
Re^2: IO::Select woes
by bliako (Abbot) on May 15, 2023 at 20:09 UTC

    perl test.pl > temp_file perl test.pl < temp_file will work only with a semicolon (;) separating the two commands: perl test.pl > temp_file ; perl test.pl < temp_file

    Edit: oh I have just noticed that haukex has added this as a comment in a moderation of the above node. So, I will add another: Or some terminals -> Or some shells.