if (sysread $handle, $command, 1024) { ... do stuff } else { ... client went away...handle it. }