#!/usr/bin/perl # http://perlmonks.org/?node_id=1192179 use strict; use warnings; my @seq = map qw( A C G T )[rand 4], 1..1e2; # fake for missing test case $_ = join '', @seq; print "$_\n\n"; print "ORF: $-[0]-", $+[1] - 1, " $&$1\n" while /ATG(?=((?:.{3})*?(?:TAG|TAA|TGA)))/g;