我有print STDERR Dumper $data
:
$VAR1 = '{
"url_date":null,
"footer":null,"id":"18",
"authors":[
{"initials":"B.","last_name":"Best","has":0,"id":12},
{"initials":"D.","last_name":"Dough","has":1,"id":10},
{"initials":"F.","last_name":"Fuss","has":0,"id":15,}
],
"url_headline":null,
"headline":"test"}';
我想访问 Dough 我该怎么做?
我试过print STDERR Dumper $data.authors[1].last_name
但是语法错误。
use JSON::XS qw( decode_json );
my $coder = JSON::XS->new->utf8->pretty->allow_nonref;
my $p = $coder->decode ($.data);