René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Data::Dumper [Perl]

use warnings;
use strict;
use Data::Dumper;

my %test = (
  one => 1,
  two => 2,
  42  =>'forty two',
);

my $some_hash_ref = {
   foo => 'bar',
   now => 'then',
};

my $some_other_hash_ref = {
  some_hash_ref => $some_hash_ref
};

$some_hash_ref -> {some_other_hash_ref} = $some_other_hash_ref;

$test{some_hash_ref} = $some_hash_ref;

open OUT, ">dumper_test_out";
print OUT Dumper(\%test);
close OUT;
use warnings;
use strict;

open IN, "dumper_test_out";
my @in = <IN>;
#print @in;
my $VAR1;
eval (join "", @in);

#  second eval on purpose
# (because of self referencing items in dumped file)
eval (join "", @in);
close IN;

print $VAR1 -> {42}, "\n";;
print $VAR1 -> {some_hash_ref}{foo}, "\n";
print $VAR1 -> {some_hash_ref}{some_other_hash_ref}{some_hash_ref}{now}, "\n";