Created
April 5, 2018 02:17
-
-
Save imyaman/11cc48649976beee2e5bf082dee6cb81 to your computer and use it in GitHub Desktop.
perl json han 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use utf8; | |
use strict; | |
use Encode; | |
use JSON; | |
binmode(STDOUT, ":utf8"); | |
my ($line, $content, $perl_hashref, %perl_hash, $key, $json); | |
$content = qq/ {"Name":"Sangyong Gwak","성명":"곽상용"} /; | |
print $content; | |
print "\n" . " ---- ---- ---- ----" . "\n"; | |
$content = Encode::encode_utf8($content); | |
$perl_hashref = decode_json($content); | |
%perl_hash = %{$perl_hashref}; | |
for $key (sort keys %perl_hash){ | |
print $key . " : " . $perl_hash{$key} . "\n"; | |
} | |
exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment