需要帮助弄清楚如何做到这一点。我的代码:
my %hash; $hash{'1'}= {'Make' => 'Toyota','Color' => 'Red',}; $hash{'2'}= {'Make' => 'Ford','Color' => 'Blue',}; $hash{'3'}= {'Make' => 'Honda','Color' => 'Yellow',}; &printInfo(%hash); sub printInfo{ my (%hash) = %_; foreach my $key (keys %_{ my $a = $_{$key}{'Make'}; my $b = $_{$key}{'Color'}; print "$a $b\n"; } }