This function receives a message on SOCKET attempting to read LENGTH bytes, placing the data read into variable SCALAR.The FLAGS argument takes the same values as the recvfrom( ) system function, on which the function is based. When communicating with sockets, this provides a more reliable method of reading fixed-length data than the sysread function or the line-based operator <FH>.
Following is the simple syntax for this function −
recv SOCKET, SCALAR, LEN, FLAGS
This function returns in Scalar Context: undef on error or Number of bytes read.