# @seq contains the following: gcttctgtc agtcatgcatgact gcgtatcatgactgcatgatatgctgct gactgagcactgtgactgcatg for (my $i=0; $i<@seq; $i++) { my @gene = $seq[$i]; my $s = join ('', @gene); @gene = split ('', $s); print "GENE @gene\n"; # FORMAT TYPE I CODING: POSITIONS 1+2 for (my $i=0; $i<@gene; $i+=3) { push @gene_type1, "$gene[$i]"; push @gene_type1, "$gene[$i+1]"; } # FORMAT TYPE 2 CODING: POSITIONS 2+3 for (my $i=0; $i<@gene; $i+=3) { push @gene_type2, "$gene[$i+1]"; push @gene_type2, "$gene[$i+2]"; } # FORMAT TYPE 3 CODING POSITIONS 3+1 for (my $i=0; $i<@gene; $i+=3) { if ($gene[$i+2] !~ /\s+/) { push @gene_type3, "$gene[$i+2]"; push @gene_type3, "$gene[$i]"; } } push @gene_type1, "\n"; push @gene_type2, "\n"; push @gene_type3, "\n"; }