This means that you are trying to send text by descriptor, but descriptors can only transmit bytes. You need to serialize the text into bytes. In particular, you want to encode text. You can use Encode encode function
print $sock encode('some_encoding', $text);
or you can instruct the socket to do this for you
binmode $sock, ':encoding(some_encoding)';
Replace some_encoding with the encoding expected by the other end of the socket (e.g. UTF-8 ).
source share