Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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 perusing the Monastery: (9)
As of 2014-12-27 04:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls