in reply to exiting sysread if no input

Use select to watch if some data is present. perldoc -f select
Boris