Help for this page

Select Code to Download


  1. or download this
    my $s1 = "STCATTNNNSATCGCT"; 
    my $s2 = "ATCGTCGSNNNNATCG";
    ...
    
    # There are 4 matching positions - marked with (#) -
    # and notice that matching N is not counted (0)
    
  2. or download this
    my $match = $s1 ^ $s2;
    my $match_count = $match =~ tr/\00//;
    ...
    
    # This gives 5, because N is counted.
    # How can I make it to return 4 instead?
    
  3. or download this
    
    get_match_count($s1,$s2);
    ...
        print "$num_match\n";
        return $num_match;
    }