in reply to Similarity of strings


I'd guess that the xor method is probably quicker but you could benchmark these as well:
# Method 1 my @a1 = split //, $ref_seq; my @a2 = split //, $test_seq; $score += ($a1[$_] eq $a2[$_]) for 0 .. $#a1; # Method 2, Destructive $score += (chop $ref_seq eq chop $test_seq) while $ref_seq;

--
John.

Replies are listed 'Best First'.
Re: Re: Similarity of strings
by professa (Beadle) on May 15, 2002 at 15:31 UTC
    chop is a bit faster than substr, it needs ~5 seconds instead of 7 seconds.

    Thanx, Micha