in reply to Re: Detecting transpositions
in thread Detecting transpositions
Or even shorter... Albeit about 3 times slower on long strings and 30% faster for short...
T I M T O W T D I
sub comp { local $_ = $_[0] ^ $_[1]; return s/([^\x00])\1//g==1 && !tr/\x00/1/c; }
T I M T O W T D I
In Section
Seekers of Perl Wisdom