多重哈希练习

[train@localhost sunpengbin]$ less duochong_hash.pl
#!/usr/bin/env perl
use strict;

my %hash;
open IN,$ARGV[0] or die "$!";
while(<IN>){
    chomp;
    my @F = split/\t/;
    push @{$hash{$F[1]}{$F[3]}},$F[2];
}
foreach my $id (sort keys %hash){
    foreach my $description (sort keys %{$hash{$id}} ){
        my $name=join "//",@{$hash{$id}{$description}};
        print "$id\t$name\t$description\n";
    }
}
You have new mail in /var/spool/mail/train
[train@localhost sunpengbin]$ less duochong_hash_exercise.txt
duochong_hash_exercise.txt: No such file or directory
[train@localhost sunpengbin]$ less duocong_hash_exercise.txt
1       AT1G04320       NA      NA
2       AT1G04370       ATERF14 "encode a member of the ERF"
3       AT1G04370       ERF14   "encode a member of the ERF"
4       AT1G04400       AT-PHH1 "Blue light receptor midiating blue"
5       AT1G04400       ATCRY2  "Blue light receptor midiating blue"
6       AT1G04400       CRY2    "Blue light receptor midiating blue"
7       AT1G04400       FHA     "Blue light receptor midiating blue"
8       AT1G04400       PHH1    "Blue light receptor midiating blue"
9       AT1G04500       NA      NA
10      AT1G04540       NA      NA
11      AT1G04780       NA      NA
12      AT1G04820       TOR2    "encodes an alpha tubulin isoform"
13      AT1G04820       TUA4    "encodes an alpha tubulin isoform"
duocong_hash_exercise.txt (END)