recv

recvSOCKET,SCALAR,LEN,FLAGS
This function receives a message on a socket. It attempts to
receive LENGTH characters (codepoints) of
data into variable SCALAR from the specified
SOCKET filehandle. The function returns the
address of the sender or undef if
there’s an error. SCALAR will grow or shrink
to the length actually read. The function takes the same flags as
recv(2), and it is actually implemented using the
recvfrom(2). See the section Sockets in Chapter 15.
Note the characters: depending on the status
of the socket, either undecoded (8-bit) bytes or fully decoded
characters are received. By default, all sockets operate on bytes. But,
for example, if the socket has been changed using binmode to operate with the :encoding(utf8) I/O layer, the I/O will
operate on UTF-8-encoded Unicode characters, not bytes.