in reply to Sending data structures via sockets

The best answer which I can offer is ... It depends.

If you are referring to the transmission of Perl data structures such as arrays and hashes, you may find some worth in the Storable module which allows such data structures to be serialised into a 'flat' form for such transmission. Alternatives to this module include Data::Dumper and FreezeThaw.

If you are referring to a plain block of information, it may be worth looking at encapsulating such data into a discrete format which can be recognised at the other end of the socket and unpacked accordingly. A simple example of such a format would be uuencoding often used in mail transmission where the encoded data is transmitted between header BEGIN and trailer END lines of text.

 

perl -le 'print+unpack("N",pack("B32","00000000000000000000001000011010"))'