while ($client) { sysread($client, $incoming, 1024); process_incoming(split /\n|\r/, $incoming); undef $incoming; sleep 1; }