Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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 imbibing at the Monastery: (11)
As of 2014-08-29 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (287 votes), past polls