3
我有一個由post方法的perl腳本接收的散列哈希,$ json。用JSON結構,解碼後處理由JSON解碼的散列的哈希
use JSON;
my $decode = decode_json($json);
這裏是從數據::自卸車結構:
$VAR1 = {
'11' => {
'_by' => 122,
'_bx' => 296,
'_ay' => 115,
'_ax' => 337
},
'21' => {
'_by' => 138,
'_bx' => 395,
'_ay' => 135,
'_ax' => 394
},
'7' => {
'_by' => 87,
'_bx' => 392,
'_ay' => 82,
'_ax' => 389
},
'17' => {
'_by' => 132,
'_bx' => 392,
'_ay' => 129,
'_ax' => 385
},
'2' => {
'_by' => 80,
'_bx' => 266,
'_ay' => 87,
'_ax' => 222
},
'22' => {
'_by' => 138,
'_bx' => 395,
'_ay' => 138,
'_ax' => 395
},
'1' => {
'_by' => 87,
'_bx' => 222,
'_ay' => 94,
'_ax' => 196
}
};
鍵真正去從0到25(我在這裏縮短結構簡潔起見)
我不知道爲什麼下面的代碼返回一個錯誤:
for (my $i=0; $i<=25; $i++) {
print $decode{$i}{'_bx'};
}
什麼是錯誤? –