Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Detecting transpositions

by Abigail-II (Bishop)
on Aug 07, 2003 at 09:50 UTC ( [id://281813]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Detecting transpositions
in thread Detecting transpositions

Well, if you do an XOR of two strings (scalars that haven't been used as numbers), perl will do a bitwise XOR on the characters of the strings, instead of the bits on the numbers. Two characters that are the same will have all the bits the same, XORing those characters will give you the character of which all the bits are 0, aka "\x00". If two characters are not the same, there is at least one bitpositions where the bits are different - resulting in a 1 bit when XORing. Hence, the resulting character will be anything but "\x00".

Abigail

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 15:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found