Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: having trouble unmasking a binary string

by Not_a_Number (Prior)
on Mar 28, 2013 at 12:33 UTC ( #1025953=note: print w/replies, xml ) Need Help??


in reply to having trouble unmasking a binary string

No need to unmask anything:

my %SWITCH = ( CAT => 0b00001, DOG => 0b00010, HAMSTER => 0b00100, FERRIT => 0b01000, FISH => 0b10000); my $petInput = 2; my @PETS; for ( keys %SWITCH ) { push @PETS, $_ if $SWITCH{$_} == $petInput; } print "$_\n" for @PETS; # DOG

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025953]
help
Chatterbox?
[Discipulus]: good morning nuns and monks!
[FloydATC]: Is CPAN down?!?
[FloydATC]: I get a 404 for www.perl.com/CPAN

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2018-01-24 08:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (256 votes). Check out past polls.

    Notices?