in reply to Getting multiline input from a server

Localizing $/ may be the source of your problems. If the server doesn't "hang up" the connection, your program may be caught waiting for more data. Unlike a regular file, a socket doesn't hit EOF until the other end hangs up, such as using either close or shutdown.

You could try reading a certain number of lines, or perhaps you are supposed to be watching out for a signal. Maybe it's something like this:
my $buffer; while (my $line = $socket->getline()) { # Maybe this is the "END" line, and if it is, # bail out of the loop because we're done! last if ($line =~ /^END$/); # Otherwise, just tack that stuff onto the buffer. $buffer .= $line; } print "Read: ", $buffer, "\n";
You could very well use <$socket> in place of the IO::Handle getline call. Note that this version will only block until the "END" line is received. The server doesn't have to hang up, and so the connection can remain open for other transmissions.

Footnote:
I honestly shudder every time I see those outrageous loop labels. Maybe they are promoted by shell-shocked veteran Fortran programmers, because over 99% of the time they serve no practical purpose, this single loop being a fine example. If you absolutely need them, by all means, but putting them in there "just because" is nonsense.