Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: binary string

by borisz (Canon)
on Jan 15, 2009 at 15:28 UTC ( #736566=note: print w/ replies, xml ) Need Help??


in reply to binary string

Assuming you want increment $cnt by one, even if more as one pattern match per byte.

my $cnt = 0; for my $num ( 0 .. 127 ) { $cnt++ if ( ( $num & 0xc0 ) == 0 || ( $num & 0x30 ) == 0 || ( $num & 0x0c ) == 0 || ( $num & 0x03 ) == 0 ); } print $cnt;
Boris


Comment on Re: binary string
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2015-07-03 06:30 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 (48 votes), past polls