我是 Perl 的新手,对哈希有一点了解。我有一个哈希数组的哈希数组哈希数组的哈希(HoAoHoAoHoAoH),如下所示。
%my_hash = (
key00 => 'value00',
key01 => [
{ key10 => 'value10',
key11 => 'value11',
key12 => [
{ key20 => 'value20',
key21 => 'value21',
key22 => [
{ key30 => 'value30',
key31 => [
{ color => 'blue', quantity => 10, boxes => [0,1,3] },
{ color => 'red', quantity => 2, boxes => [2,3] },
{ color => 'green', quantity => 5, boxes => [0] },
],
},
],
},
]
}
]
);
访问“颜色”、“数量”和“框”的最简单方法是什么?我还需要对“数量”进行算术运算,例如 10+2+5 (quantity0+quantity1+quantity2)。