Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Bitwise Operator Error

by almut (Canon)
on Oct 02, 2008 at 21:46 UTC ( #715099=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $testString = "          00008008 000000FF 00800000";
    $testString =~ s/\s+//g;
    ...
    my $maskResult = substr($bits, 1, 1) eq '1';
    
    printf "%s\n--> 2nd bit from left: %d\n", $bits, $maskResult;
    
  2. or download this
    my $testString = "          01008008 000000DF 00800000";
    my $mask       =           "42000000 00000020 00000000";
    ...
    $maskResult =~ tr/\0//d;
    
    printf "There were %s matching bits.\n", length($maskResult) ? "some":
    +"no";
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2015-01-27 23:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My top resolution in 2015 is:

















    Results (210 votes), past polls