in reply to read binary datas

To read in "binary mode" (that is, to read data that isn't structured into lines), you have to figure out when to stop reading one thing and start reading another. The simpest case is when you want to read a fixed number of bytes, in which case you can just use read. Some protocols will send a length byte followed by some data, in which case you'll read the length byte, then read the rest. Some protocols will keep sending data until a delimiter, in which case you can read one byte at a time until you find the ending delimiter (or process it as text, setting the $/ variable). As you can see, exactly how to do it depends on exactly how the data is formatted.

To write in binary mode, use print.

pack and unpack can also be useful for parsing some types of binary data.

I believe you'll also want to use binmode($sock) to put the socket in binary mode, which will avoid automatic translation between DOS/Windows and Unix style line endings.