in reply to Re^3: Comparing Lines within a Word List
in thread Comparing Lines within a Word List
I hope everyone in the thread can see this, and not just the author of the note on which I hit the reply button.
They can.
I'm not immediately sure why the "difference" between the character 'l' and 't' would be 30 ...
You're seeing the octal values resulting from the character-by-character bitwise-xor of two strings. So
c:\@Work\Perl\monks>perl -wMstrict -le "printf qq{%#02o \n}, ord 'l'; printf qq{%#02o \n}, ord 't'; printf qq{%#02o \n}, 0154 ^ 0164; " 0154 0164 030
... the problem ... [find] from ... a massive dictionary of English language words -- all pairs of words that are the same except for one letter, and in particular, for that character difference to be that one has an R while the other has an S [in the same character position] ...
[please note the emphasized addition]
As to this much larger problem (as restated; please confirm this clarification — or may the differing characters be in any position? (Update: E.g., Is 'aSaa' a "match" for 'aaRa'?)): it's an interesting one, but I've no time right now to go into it in detail.
Update: Actually, the '02' in the '%#02o' format specifier used in the printfs above is unnecessary, although it does no harm. The same result (and the result I wanted) can be had with '%#o' instead.
Give a man a fish: <%-{-{-{-<
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Comparing Lines within a Word List
by dominick_t (Acolyte) on Apr 27, 2016 at 16:39 UTC |
In Section
Seekers of Perl Wisdom