Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Extracting Bit Fields (Again)

by BrowserUk (Patriarch)
on Oct 12, 2005 at 04:26 UTC ( [id://499368]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    print unpack 'C*', pack '(B8)*', map{ 
           substr '00000000'.$_, -8 
    } unpack 'A1A3A4',unpack 'B*',pack 'C', 162;;
    
    1 2 2
    
  2. or download this
    ## pack 162 into an 8-bit binary value (a char).
    pack 'C', 162       
    ...
    
    ## and convert those to ascii-decimal for display
    print
    
  3. or download this
    #! perl -slw
    use strict;
    ...
    1
    2
    2
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-25 18:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found