local $/ = "\x00"; $response = $socket->getline; if ($socket->eof) { ... }