如何遍歷反序列化的json字符串?我現在無法獲得正確數量的值,因此無法正確計數。json in perl反序列化長度計數不起作用
my $list = request("http://localhost/getjson.php");
my $deserialize = from_json($list);
print Dumper($deserialize);
$VAR1 = [
'ab',
'cc',
'de',
'aer',
'ffe',
'cer',
'dad',
'efef',
'afaf',
'ege',
'grsc',
'cegg',
'cegg',
'cegg/aaa.html',
'eggt',
'ttt'
];
print length($deserialize);
13 ?? it should say 16
難道你忘了上'deserialize'的'$'印記錯字,或者是在你的實際代碼? – TLP 2012-02-21 01:07:13
還不好意思打錯了。 – user391986 2012-02-21 01:14:37