4 msglog missing images
2 msgdatabase Cgi query's
3 msgFile opening problem
3 msg$^I
4 msgCan't run PERL scripts on a shared server?

comparing two binary numbers
\ Johnson Lau (11 May 2008)
. \ Li, Jialin (11 May 2008)
. \ Dr.Ruud (11 May 2008)
. \ sisyphus (11 May 2008)
. \ Chris Charley (11 May 2008)
. \ John W. Krahn (12 May 2008)
. \ Dr.Ruud (12 May 2008)

8 msgPlease help critcize and shorten my sub code
3 msgsplit slice question
4 msgperl-support for vim help needed
4 msgText to hex
1 msgPerl MQSeries API newbie help
3 msgdns error or module error?
3 msgscript for an mbox
4 msgdeleting a user name from a file
1 msgDocumentation problem
5 msgone liner for for and if
3 msgerror in printing unicode
2 msginstall module problem
1 msgCan't get Text::Balanced::extract_quotelike to ...
3 msgRegex help?
Subject:comparing two binary numbers
Group:Perl-beginners
From:Johnson Lau
Date:11 May 2008


 
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

--
To unsubscribe, e-mail: beginners-unsubscribe
For additional commands, e-mail: beginners-help
http://learn.perl.org/




© 2004-2008 readlist.com