Skip to content

Instantly share code, notes, and snippets.

@dyng
Created December 12, 2012 07:49
Show Gist options
  • Save dyng/4265896 to your computer and use it in GitHub Desktop.
Save dyng/4265896 to your computer and use it in GitHub Desktop.
比较两个json是否等价(perl版)
#! /usr/bin/env perl
use warnings;
use strict;
use utf8;
use JSON::XS;
use Data::Compare;
use Path::Class;
my ($a_json, $b_json) = @ARGV;
my $coder = JSON::XS->new->latin1;
chomp (my $a = file($a_json)->openr->getline);
chomp (my $b = file($b_json)->openr->getline);
print Compare($coder->decode($a), $coder->decode($b)) ? "Identical\n" : "Not Identical\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment