sub try_read(socket) buf = "" loop if (IO::Select->can_read socket) buf .= sysread(socket, 1); else exit loop return buf