Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: converting artibrary binary data to numeric values

by Corion (Patriarch)
on Oct 01, 2012 at 20:17 UTC ( [id://996736]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use Data::Dumper;
    my $str = "\x0D\x0E\x0A\x0D\x0B\x0E\x0E\x0F";
    ...
    
    my $num = unpack 'N', pack 'C4', @bytes;
    print sprintf "%08x (%i)", $num, $num;
    
  2. or download this
    my $str = "\xDE\xAD\xBE\xEF";
    my $num = unpack 'N', $str;
    print sprintf "%08x (%i)", $num, $num;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://996736]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-26 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found