Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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
Replies are listed 'Best First'.
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 having an uproarious good time at the Monastery: (10)
As of 2015-07-08 06:17 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 (94 votes), past polls