"John W. Krahn" schreef:
> Johnson Lau:
>> I need to compare two binary numbers and need perl to return the
>> number of matching bits. For example:
>> $aaa = "1000";
>> $bbb = "00101100";
>
> Those aren't binary numbers, they are strings.
I don't mind reading "binary number" as "some
Johnson Lau wrote:
Dear all,
Hello,
I need to compare two binary numbers and need perl to return the
number of matching bits.
For example:
$aaa = "1000";
$bbb = "00101100";
Those aren't binary numbers, they are strings.
perldoc perlnumber
In this case, the number of matching bits i
- Original Message -
From: ""Johnson Lau"" <[EMAIL PROTECTED]>
Newsgroups: perl.beginners
To:
Sent: Sunday, May 11, 2008 1:09 AM
Subject: comparing two binary numbers
Dear all,
I need to compare two binary numbers and need perl to return the
number of m
On May 11, 3:09 pm, [EMAIL PROTECTED] (Johnson Lau) wrote:
> Dear all,
>
> I need to compare two binary numbers and need perl to return the
> number of matching bits.
>
> For example:
>
> $aaa = "1000";
> $bbb = "00101100";
>
> In this case, the number of matching bits is 6.
>
use strict;
use
"Johnson Lau" schreef:
> I need to compare two binary numbers and need perl to return the
> number of matching bits.
>
> For example:
>
> $aaa = "1000";
> $bbb = "00101100";
>
> In this case, the number of matching bits is 6.
perl -Mstrict -Mwarnings -le'
my $b1 = "1000";
my $b2 =
On 5/11/08, Johnson Lau <[EMAIL PROTECTED]> wrote:
>
> Dear all,
>
> I need to compare two binary numbers and need perl to return the
> number of matching bits.
>
> For example:
>
> $aaa = "1000";
> $bbb = "00101100";
>
> In this case, the number of matching bits is 6.
>
> I know I could split
Dear all,
I need to compare two binary numbers and need perl to return the
number of matching bits.
For example:
$aaa = "1000";
$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