I would have organized the code slightly differently, factoring each of the pattern elements into a separate qr// regex object and combining them together (inside a capture group) in the final m// match:
c:\@Work\Perl\monks>perl -wMstrict -le
"my $codon = qr{ [ACGT]{3} }xms;
my $start = qr{ ATG }xms;
my $end = qr{ TAG | TAA | TGA }xms;
;;
my $seq = 'AATGGTTTCTCCCATCTCTCCATCGGCATAAAAATACAGAATGATCTAACGAA';
;;
print qq{'$1'} while $seq =~ m{ ($start $codon*? $end) }xmsg;
"
'ATGGTTTCTCCCATCTCTCCATCGGCATAA'
'ATGATCTAA'
Separate
qr// definitions ease maintenance and, if variable names be wisely chosen, are self-commenting. If possible, I only use capture groups in the final
m// match due to the confusion that trying to count nested capture groups can produce.
Give a man a fish: <%-{-{-{-<