in reply to use sysread to read non-blocking filehandle

When you get EAGAIN, why are you exiting the loop? That indicator tells you that you should try another read, probably after a small delay -- basically you have not received any new data to read. Adjust that portion of code (don't call last) and your termination test in the while loop and you should see different results.

Ref: sysread, What does eagain mean (SO)