for ( my $i = 0 ; $i < $l ; $i++ ) { foreach my $nucl (@nucleotides) { substr( $cand_motif, $i, 1 ) = $nucl; push @enumerated_motifs, $cand_motif; #print "$cand_motif\n"; } }