Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Reading Binary

by duelafn (Priest)
on Jun 15, 2011 at 16:30 UTC ( #909806=note: print w/ replies, xml ) Need Help??


in reply to Reading Binary

You can use vec for this

#!/usr/bin/perl use strict; use warnings; my @letter = 'A'..'Z'; my $bits = pack "b*", "1001"; for (0..8*length($bits)-1) { print $letter[$_] if vec($bits,$_,1); } print "\n";

Good Day,
    Dean


Comment on Re: Reading Binary
Download Code
Re^2: Reading Binary
by BoulderBuff64 (Novice) on Jun 20, 2011 at 22:19 UTC
    This is the method I ended up using. Thanks!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2015-07-04 15:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls