Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > comparing two b...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 11053 of 11531
Post > Topic >>

comparing two binary numbers

by johnsonlau@[EMAIL PROTECTED] (Johnson Lau) May 11, 2008 at 01:09 PM

Dear all,

I need to compare two binary numbers and need perl to return the
number of matching bits.

For example:

$aaa = "10111100";
$bbb = "00101100";

In this case, the number of matching bits is 6.

I know I could split the strings and compare the bits one by one.
However, is there any faster functions for this? I need to compare
millions of such strings with 1000 bits for each.

Thanks a lot!!

Johnson Lau
 




 7 Posts in Topic:
comparing two binary numbers
johnsonlau@[EMAIL PROTECT  2008-05-11 13:09:05 
Re: comparing two binary numbers
jialinli1981@[EMAIL PROTE  2008-05-11 02:40:09 
Re: comparing two binary numbers
rvtol+news@[EMAIL PROTECT  2008-05-11 12:37:18 
Re: comparing two binary numbers
sisyphus359@[EMAIL PROTEC  2008-05-11 03:02:01 
Re: comparing two binary numbers
charley@[EMAIL PROTECTED]  2008-05-11 16:16:38 
Re: comparing two binary numbers
krahnj@[EMAIL PROTECTED]   2008-05-12 02:02:10 
Re: comparing two binary numbers
rvtol+news@[EMAIL PROTECT  2008-05-12 15:40:17 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 19:13:51 CDT 2008.