Sends a message on a socket. Attempts to send the scalar MSG to the SOCKET filehandle. Takes the same flags as the system call of the same name. On unconnected sockets, you must specify a destination to send to, in which case it does a sendto(2) syscall. Returns the number of characters sent, or the undefined value on error. The sendmsg(2) syscall is currently unimplemented. See "UDP: Message Passing" in perlipc for examples.
Note that if the socket has been marked as :utf8
, send
will throw an exception. The :encoding(...)
layer implicitly introduces the :utf8
layer. See binmode
.