Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 having an uproarious good time at the Monastery: (7)
As of 2016-09-27 10:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (501 votes). Check out past polls.