|Perl Language Reference Manual|
by Larry Wall and others
Paperback (6"x9"), 724 pages
RRP £29.95 ($39.95)
Sales of this book support The Perl Foundation! Get a printed copy>>>
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 20.7 for examples.
Note the characters: depending on the status of the socket, either
(8-bit) bytes or characters are sent. 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 (see
, or the
open pragma, "Perl pragma to set default PerlIO layers for input and output" (open) in the Perl Library Reference Manual (Volume 1)), the I/O will operate on UTF-8
encoded Unicode characters, not bytes. Similarly for the
pragma: in that case pretty much any characters can be sent.
|ISBN 9781906966027||Perl Language Reference Manual||See the print edition|