Perl 二維數組

my %hash ;scala

$hash{"projectA"}{"12"} = "job_12"; $hash{"projectA"}{"91"} = "job_91"; $hash{"projectA"}{"15"} = "job_15"; $hash{"projectA"}{"31"} = "job_31";code

$hash{"projectB"}{"11"} = "job_11"; $hash{"projectB"}{"17"} = "job_17"; $hash{"projectB"}{"151"} = "job_121"; $hash{"projectB"}{"111"} = "job_111";hash

foreach my $procedure (keys %hash) {foreach

my @list =  sort {$b <=> $a} keys $hash{$procedure}; 
print "@list  \n" ;

for(my $i=0;$i< scalar(@list) ;$i++){
  if($i>=2){
     print "produce =$procedure   id = $list[$i]   $hash{$procedure}{$list[$i]}  \n";
   }
}

}sort

相關文章
相關標籤/搜索