Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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 exploiting the Monastery: (21)
As of 2014-07-29 15:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (219 votes), past polls