Sha256: e6fa0d812789d2671a45eb4c5aa4bb9235e1b4db6cfa8f2ad4c3a3b9958342d1

Contents?: true

Size: 360 Bytes

Versions: 293

Compression:

Stored size: 360 Bytes

Contents

package Example;

use strict;
use warnings;

use Carp;

sub compute {
    my ($strand_a, $strand_b) = @_;

    croak "DNA strands must be of equal length"
        unless length $strand_a == length $strand_b;

    my $distance = $strand_a ^ $strand_b;
    $distance =~ s/\0//g;

    return (length $distance) - abs(length($strand_a) - length($strand_b));
}

1;

Version data entries

293 entries across 293 versions & 1 rubygems

Version Path
trackler-2.2.1.105 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.104 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.103 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.102 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.101 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.100 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.99 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.98 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.97 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.96 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.95 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.94 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.93 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.92 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.91 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.90 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.89 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.88 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.87 tracks/perl5/exercises/hamming/Example.pm
trackler-2.2.1.86 tracks/perl5/exercises/hamming/Example.pm