Memoize

BasicWerk   EC Support   Technique   Facebook  

20141120222008_Perl_from_JSON

Perl_from_JSON

 

 

 
% cat sample.json
{
   "aaa" : [
      "yyy",
      "30"
   ],
   "bbb" : [
      "jjj",
      "70"
   ],
   "ccc" : [
      "k",
      "89"
   ]
}
 

 

fromJSON.pl
 
#! /usr/bin/perl
use warnings;
use strict;
use JSON;
 
my $json_file = shift;
my $json_str = `cat "$json_file"`;
my $hash_ref = from_json($json_str);
 
print $hash_ref->{aaa}->[0], "\n";
 

 

 
% fromJSON.pl sample.json
yyy
 

 


© Shin Nakamura/BasicWerk 2014