Thread einen Hash kompakter schreiben
(5 answers)
Opened by hawahe at 2010-06-06 13:49
Hallo Community,
ich wüsste gerne, ob es eine Möglichkeit gibt den folgenden hash kürzer zu schreiben: Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 %codons = ( "GCU" => "Ala", "GCC" => "Ala", "GCA" => "Ala", "GCG" => "Ala", "UGU" => "Cys", "UGC" => "Cys", "GAU" => "Asp", "GAC" => "Asp", "GAA" => "Glu", "GAG" => "Glu", "UUU" => "Phe", "UUC" => "Phe", "GGU" => "Gly", "GGC" => "Gly", "GGA" => "Gly", "GGG" => "Gly", "CAU" => "His", "CAC" => "His", "AUU" => "Ile", "AUC" => "Ile", "AUA" => "Ile", "AAA" => "Lys", "AAG" => "Lys", "CUU" => "Leu", "CUC" => "Leu", "CUA" => "Leu", "CUG" => "Leu", "UUA" => "Leu", "UUG" => "Leu", "AUG" => "Met", "AAU" => "Asn", "AAC" => "Asn", "CCU" => "Pro", "CCC" => "Pro", "CCA" => "Pro", "CCG" => "Pro", "CAA" => "Gln", "CAG" => "Gln", "CGU" => "Arg", "CGC" => "Arg", "CGA" => "Arg", "CGG" => "Arg", "AGA" => "Arg", "AGG" => "Arg", "AGU" => "Ser", "AGC" => "Ser", "UCU" => "Ser", "UCC" => "Ser", "UCA" => "Ser", "UCG" => "Ser", "ACU" => "Thr", "ACC" => "Thr", "ACA" => "Thr", "ACG" => "Thr", "GUU" => "Val", "GUC" => "Val", "GUA" => "Val", "GUG" => "Val", "UGG" => "Trp", "UAU" => "Tyr", "UAC" => "Tyr", "UAA" => "STOPP", "UAG" => "STOPP", "UGA" => "STOPP", "UGG" => "STOPP", ); wie ihr sehen könnt, hadelt es sich um einen hash indem sich die sogenannte codesonne befindet. da es jetzt aber mehrere schlüssel mit dem gleichen wert gibt müsste es doch eine methode geben, diese in eine liste oder ähnlichem zusammen zu fassen. bin für anregungen sehr dankbar mfg ~hawahe Last edited: 2010-06-06 14:01:07 +0200 (CEST) |