#!/usr/bin/perl -w use strict; use Data::Dumper; my $dump; { # Writer # ----- my $hash = {}; my @ray=qw(bob me other); foreach (@ray) { %{$hash->{$_}} = ( one => $_+1, two => $_+2, three => $_+3, ); } print(Dumper($hash)); $dump = Data::Dumper->new([ $hash ], [qw( $hash )]) ->Purity(1) ->Dump(); } { # Reader # ------ my $hash; eval "$dump; 1" or die $@; print(Dumper($hash)); }