PerlでJSON形式データ作成・出力

 

use Encode;
use JSON;

my $data_to_json = {
  name => $name,
  address => \@address,
  phone => \@phone
};
print encode_json($data_to_json) . "\n";