Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^5: converting artibrary binary data to numeric values

by Corion (Pope)
on Oct 02, 2012 at 07:18 UTC ( #996817=note: print w/replies, xml ) Need Help??

in reply to Re^4: converting artibrary binary data to numeric values
in thread converting artibrary binary data to numeric values

If you just want "the values", then keep them as strings. If that seems problematic, you have to show some code where you show how you acquire the data (say, from initializing a string), how you unpack it, and what you want to do with it in the end.

If you want "the values" as "number", then you have to unpack them from the string. As long as you are dealing with four-byte numbers, or your Perl and the C program have the same interpretation of the long type, there will be no loss of accuracy.

As for your questions about alignment etc., that is what Convert::Binary:C is set up to handle.

Replies are listed 'Best First'.
Re^6: converting artibrary binary data to numeric values
by markle (Initiate) on Oct 02, 2012 at 20:31 UTC
    Turns out my debug routine was the thing splitting from string representations of the decimal values. Unpack and Convert::Binary::C were working fine. Dunce cap. :-) Binary makes me woozy.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996817]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2017-02-21 21:26 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (319 votes). Check out past polls.