for (my $i=0; $i < (length($dna)-2);$i+=3) { my $codon =substr($dna,$i,3); my $protein .= codon2aa($codon); } print "$protein";