Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Tri state string compare? (Solved! see update2)

by BrowserUk (Patriarch)
on Dec 13, 2015 at 21:19 UTC ( [id://1150180]=note: print w/replies, xml ) Need Help??


in reply to Re: Tri state string compare? (Solved! see update2)
in thread Tri state string compare? (Solved! see update2)

There's something missing in that solution, or I don't understand it

Does the fact that I know all my strings will be equal length explain things?

Here's my test code:

#! perl -slw use strict; my $pat = 'AAAAAAABCCCCCCCCABAAAAAAA'; my @set = ( 'AAAAAAABAAABABBBABAAAAAAA', 'AAAAAAABAAABBABBABAAAAAAA', 'AAAAAAABAAABBBABABAAAAAAA', 'AAAAAAABBAAABABBABAAAAAAA', 'AAAAAAABBAAABBABABAAAAAAA', 'AAAAAAABBBAAABABABAAAAAAA', 'ABAAAAABAAABABBBABAAAAAAA', 'AAAAAAAAAAABBABBABAAAAAAA', 'AAAAAAABAAABBBABAABAAAAAA', 'AAAAAAABBAAABABBABAAAAAAA', 'AAAAABABBAAABBABAAAAAAAAA', 'AAAAAAABBBAAABABAAAAAAAAA', ); for my $test ( @set ) { printf "$pat\n$test\n%s %s\n\n", $pat & $test, ( $pat & $test ) eq + $test ? 'OK' : 'NO'; } __END__ C:\test>junk77 AAAAAAABCCCCCCCCABAAAAAAA AAAAAAABAAABABBBABAAAAAAA AAAAAAABAAABABBBABAAAAAAA OK AAAAAAABCCCCCCCCABAAAAAAA AAAAAAABAAABBABBABAAAAAAA AAAAAAABAAABBABBABAAAAAAA OK AAAAAAABCCCCCCCCABAAAAAAA AAAAAAABAAABBBABABAAAAAAA AAAAAAABAAABBBABABAAAAAAA OK AAAAAAABCCCCCCCCABAAAAAAA AAAAAAABBAAABABBABAAAAAAA AAAAAAABBAAABABBABAAAAAAA OK AAAAAAABCCCCCCCCABAAAAAAA AAAAAAABBAAABBABABAAAAAAA AAAAAAABBAAABBABABAAAAAAA OK AAAAAAABCCCCCCCCABAAAAAAA AAAAAAABBBAAABABABAAAAAAA AAAAAAABBBAAABABABAAAAAAA OK AAAAAAABCCCCCCCCABAAAAAAA ABAAAAABAAABABBBABAAAAAAA A@AAAAABAAABABBBABAAAAAAA NO AAAAAAABCCCCCCCCABAAAAAAA AAAAAAAAAAABBABBABAAAAAAA AAAAAAA@AAABBABBABAAAAAAA NO AAAAAAABCCCCCCCCABAAAAAAA AAAAAAABAAABBBABAABAAAAAA AAAAAAABAAABBBABA@@AAAAAA NO AAAAAAABCCCCCCCCABAAAAAAA AAAAAAABBAAABABBABAAAAAAA AAAAAAABBAAABABBABAAAAAAA OK AAAAAAABCCCCCCCCABAAAAAAA AAAAABABBAAABBABAAAAAAAAA AAAAA@ABBAAABBABA@AAAAAAA NO AAAAAAABCCCCCCCCABAAAAAAA AAAAAAABBBAAABABAAAAAAAAA AAAAAAABBBAAABABA@AAAAAAA NO

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-19 07:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found