Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Is it possible to generate all possible combinations of 2-letter and 3-letter words in perl?

by pvaldes (Chaplain)
on Sep 03, 2012 at 09:49 UTC ( #991381=note: print w/ replies, xml ) Need Help??


in reply to Is it possible to generate all possible combinations of 2-letter and 3-letter words in perl?

Now available with uracil flavour

use strict; use warnings; my @bas = ("A","G","C","T","U"); my @all = (); for my $a1(@bas){ for my $a2(@bas){ for my $a3(@bas){ push @all, "$a1$a2$a3\n"}} my @codon = grep !/(U.*T|T.*U)/, @all; for my $valid(@codon){ print $valid } }

EDIT: improved, codons with T + U off


Comment on Re: Is it possible to generate all possible combinations of 2-letter and 3-letter words in perl?
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991381]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2015-07-30 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls