File#1 dna: species_1 ACCATGATACGATG species_2 GGTTTCGACGCAGA species_3 GGACTCAGCGACTA File#2 morph: species_1 001001010201001001 species_2 002010200210120201 species_4 001001110000000101 species_5 111001001001000201 #### species_1 ACCATGATACGATG001001010201001001 species_2 GGTTTCGACGCAGA002010200210120201 species_3 GGACTCAGCGACTA?????????????????? species_4 ??????????????001001110000000101 species_5 ??????????????111001001001000201 #### open IN, "dnamorph.txt" or die $!; my %data; my $taxon; while () { if (/(^\w+)(\t+)(\w+)/) { $taxon = $1; push @{ $data{$taxon} }, $3; } } #### species_1 ACCATGATACGATG001001010201001001 species_2 GGTTTCGACGCAGA002010200210120201 species_3 GGACTCAGCGACTA species_4 001001110000000101 species_5 111001001001000201 #### open DNAA, "dna.nxs" or die $!; my %ddata; while () { if (/(^\w+)(\t+)(\w+)/) { $ddata{ $1} = { dna => $3, }; } } #### species_six: dna=TTGGGACAGCCGAGGCACGA species_two: dna=AAAATCGGGCGGCGCTTTTC species_five: dna=TTCCAGGACATCGGCATACG species_three: dna=GGGGCCCCAATATCGATACG species_four: dna=GGGGAGGACGTAGATATTAT species_one: dna=ACTGTTTCGTAGGGCTAGGA species_two: morph=111101011011011 species_five: morph=111101011011011 species_three: morph=012111011011011 species_four: morph=112111011011011 species_one: morph=110111011011111