0

这是我的 Perl 程序

package ABCD;
use base qw/JSON::XS/;

my $json = '{"alphabet" : ["a:1", "b:2", "c:3", "d:4"],"number" : ["1:a","2:b"]}';
my $decoded = decode_json($json);

当我执行此操作时,我收到一个错误,例如

&test::decode_json在 test.pm 第 4 行第 1 行调用的未定义子例程<STDIN>

4

1 回答 1

0

你可以试试这个运行:

use JSON::XS;
use Data::Dumper;

my $json = '{"alphabet" : ["a:1", "b:2", "c:3", "d:4"],"number" : ["1:a","2:b"]}';
my $decoded = decode_json($json);
print Dumper($json,$decoded);
于 2013-11-13T14:32:20.013 回答