tags:

views:

63

answers:

1

My Perl script gets a UDP response that is built out of 2 integers + float numbers. The problem is that the UDP stream is one long stream of bytes.

How do I cast the stream into parameters using Perl?

+1  A: 

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.

daotoad
thank you very much