Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: How to sort record using pack function ?

by Marshall (Canon)
on Sep 02, 2010 at 10:43 UTC ( [id://858544]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #we are packing nibbles (4 bits) at a time
    # H is big-endian order
    ...
    binmode(BIN);
    print BIN $raw;
    close BIN;
    
  2. or download this
    # v1 is a little-endian 16 bit (short) so needs 2 bytes
    # if substr didn't limit to 2 bytes substr($raw,1) works also
    ...
    print $len,"\n";                          #prints 71
    print unpack ('v', substr($raw,1)),"\n";  #prints 71
    print unpack ('x v', $raw ),"\n";         #prints 71
    
  3. or download this
    record:
       unsigned char  record_type   8 bits
       unsigned short length        16 bits little endian
       ... some data type and description of these sections...
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-16 12:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found