in reply to Re: Accessing variables in an external hash without eval
in thread Accessing variables in an external hash without eval
JSON cannot store "arbitrary structures". Not unless your definition of "arbitrary" is extremely limited. It can't contain cyclic references for example. Something like this can be represented in Perl code, Storable, YAML, and (using IDREF) probably in XML, but not JSON…
use strict; use warnings; use Data::Dumper qw(Dumper); use YAML::XS qw(Dump); my $data = do { my $child = {}; my $parent = { child => $child }; $child->{parent} = $parent; }; print "#### Perl ####\n"; print Dumper($data), "\n"; print "#### YAML ####\n"; print Dump($data), "\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Accessing variables in an external hash without eval
by afoken (Chancellor) on May 17, 2017 at 19:55 UTC |