My Perl script gets a UDP response that is built out of 2 integers + float numbers. The problem is that the UDP stre开发者_开发问答am is one long stream of bytes.
How do I cast the stream into parameters using Perl?
You can use unpack or Convert::Binary::C.
For more on pack and unpack see perlpacktut - the Pack Tutorial.
With Convert::Binary::C, you pass in a C struct definition, and then you can easily extract the data members from the struct.
精彩评论