【发布时间】:2012-08-04 02:11:36
【问题描述】:
我正在查看以下演示嵌套哈希的代码:
my %HoH = (
flintstones => {
husband => "fred",
pal => "barney",
},
jetsons => {
husband => "george",
wife => "jane",
"his boy" => "elroy", # Key quotes needed.
},
simpsons => {
husband => "homer",
wife => "marge",
kid => "bart",
},
);
为什么最上面的哈希(从第 1 行开始)使用括号初始化,而子哈希使用花括号初始化?
来自 python 背景,我必须说 Perl 很奇怪:)。
【问题讨论】: