As repellent noted, JSON::XS is *very* fast. For some data sizes (in some benchmarks) it beats Storable. Here's a sample. Note the examples show the main caveat, JSON cares whether things are numbers or strings.
use JSON::XS;
my %bingo = ( one => 1,
two => 2,
three => 5, );
my %bongo = ( three => 5,
two => 2,
one => 1,
);
my %bango = ( one => "1",
two => "2",
three => "5", );
print "Is bingo bongo? ",
encode_json(\%bingo) eq encode_json(\%bongo) ? "yes!\n" : "noes :(
+\n";
print "Is bango bongo? ",
encode_json(\%bango) eq encode_json(\%bongo) ? "yes!\n" : "noes :(
+\n";
Is bingo bongo? yes!
Is bango bongo? noes :(