Perl 二维数组

my %hash ;

$hash{“projectA”}{“12”} = “job_12”;
$hash{“projectA”}{“91”} = “job_91”;
$hash{“projectA”}{“15”} = “job_15”;
$hash{“projectA”}{“31”} = “job_31”;

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

foreach my $procedure (keys %hash) {

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";
   }
}

}

你可能感兴趣的:(Perl 二维数组)