Finding a Spliced Motif

Author: L. Grondin

http://rosalind.info/problems/sseq/

Sample input

ACGTACGTGACG
GTA

Sample output

3 4 5

Source code: sseq-grondilu.pl

use v6;

my @default-data = qw{ACGTACGTGACG GTA};

sub MAIN($input-file = Nil) {
    my ($dna, $search) = $input-file ?? $input-file.IO.lines !! @default-data;

    my $pos = 0;
    my @arr = gather for $search.comb -> $c {
        $dna ~~ m:c($pos)/$c/;
        take $pos = $/.from + 1;
    }
    say "{@arr}"
}