2

我有以下多维哈希变量

my %billingMember ;
$billingMember{1}->{'useremail_quota'} = 10;
$billingMember{1}->{'useremail_blockedquota'} = 5;

$billingMember{2}->{'useremail_quota'} = 10;
$billingMember{2}->{'useremail_blockedquota'} = 5;

如何解析变量 %billingMember ?

即我需要得到每个值

$billingMember{1}->{'useremail_quota'},

$billingMember{1}->{'useremail_blockedquota'} ,

$billingMember{2}->{'useremail_quota'}, ....

这里 1&2 只是举例,它会动态

所以我认为,我们需要使用foreachfor

4

1 回答 1

2

一些样本取自http://perldoc.perl.org/perldsc.html#HASHES-OF-HASHES

 foreach $family ( keys %HoH ) {
     print "$family: { ";
     for $role ( keys %{ $HoH{$family} } ) {
         print "$role=$HoH{$family}{$role} ";
     }
     print "}\n";
 }

(编辑:只保留可能对您有用的那个)

于 2013-04-30T06:25:55.210 回答