Finding a Motif in DNA

Author: L. Grondin

http://rosalind.info/problems/subs/

Sample input

GATATATGCATATACTT
ATAT

Sample output

2 4 10

Source code: subs-grondilu.pl

use v6;

my @default-data = qw{GATATATGCATATACTT ATAT};

sub MAIN($input-file = Nil) {
    my ($S, $t) = $input-file ?? $input-file.IO.lines !! @default-data;
    my @arr = gather for $S.match(/$t/, :overlap) { take 1+.from };
    say "{@arr}"
}