$seq = "GAGtatCTGGAAGACAGGCAGACTTTTCGCCACAGCGTGGTGGTACCTTATGAGCCACCCGAGGCCGGCT";

$pos = 0;

while ($codon = substr($seq, $pos, 3)) {
    print "$codon ";
    $pos = $pos + 3;
}