Проект

Общее

Профиль

Json

#!/usr/bin/env perl
use strict;    #use this all times
use warnings;  #this too - helps a lot!

#use JSON; 
use Cpanel::JSON::XS; # pkg install p5-JSON-XS p5-JSON-MaybeXS
use Data::Dumper;

my $json_str = '{ "items" : [ 1, 2, 3, 4 ] } ';
my $content = decode_json($json_str);

my $aref = $content->{items};   #$hashref->{key}
#or
#my $aref = ${$content}{items}; #$hash{key}
#$content->{items}->[0];