# The snippet below returns Score = 4 for (GG,GG)-case sub score { my ($str,$array) = @_; my %position_score; my $offset = 0; for my $frag (@{$array}) { #my $idx = index($str, $frag) + 1; my $idx = index($str, $frag, $offset) + 1; for my $pos ($idx .. $idx + (length($frag) - 1)) { $position_score{$pos} = 1; }; $offset = $idx; };
In reply to Re^2: Substring Distance Problem
by monkfan
in thread Measuring Substrings Problem
by monkfan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |