Skip to content

Instantly share code, notes, and snippets.

@sky-joker
Created July 30, 2016 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sky-joker/071c60b47dfe22396db9cbdc025f7879 to your computer and use it in GitHub Desktop.
Save sky-joker/071c60b47dfe22396db9cbdc025f7879 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
use JSON;
my $json = JSON->new();
my @array = ();
my %list = ();
# 1個目
$list{'{#NAME}'} = "EXAMPLE1";
$list{'{#STAT}'} = "UP";
push(@array, $json->decode($json->encode(\%list)));
# 2個目
$list{'{#NAME}'} = "EXAMPLE2";
$list{'{#STAT}'} = "UP";
push(@array, $json->decode($json->encode(\%list)));
undef(%list);
$list{'data'} = \@array;
print $json->encode(\%list), "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment