use Data::Dumper; my %h = ( foo => 1, bar => { quux => 2, frob => 3, }, ); open my $fh, '>', 'hash.pl' or die "nope: $!"; print $fh Dumper(\%h); close $fh or die "fasten seat belts. Last orders: $!"; #### my %h = %{ require 'hash.pl' }; die "read hash dinn' work: $@" if $@;