use Storable qw/ freeze thaw /; # Create serial representation of hash structure $serialised = freeze \%hash; . . . # Recreate hash structure from serial representation %hash = %{ thaw( $serialised ) }