http://qs1969.pair.com?node_id=521757

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am attempting to read a flat file that describes an array of hash references into a similar DBM hash where it will be modified and stored for another process. When I test this by first printing out the hash_ptr everything works!When I print out hash_ref( with same address) it references nothing?
The flat file has this
@HASHES = ( \%Data_Directories_fetch, \%DataDirectories_erase, \%Progr +am_fetch, \%Program_erase, \%Configuration_and_Table_Files_erase, \%Configuration_and +_Table_Files_fetch, \%Create_Database, \%Load_Database );
The function is called with no arguments.
Thanks Much!


sub loadDefaultsToDBM { my $cntr = 0; foreach $element (@HASHES) { print "$cntr --$element "; switch($cntr++) { case 0 { print "Data_Directories_fetch\n"; $TESS_CONFG{"Data_D +irectories_fetch"} = $element; } case 1 { print "Data_Directories_erase\n"; $TESS_CONFG{"Da +ta_Directories_fetch"} = $element; } case 2 { print "Program_fetch\n"; $TESS_CONFG{"Pr +ogram_fetch"} = $element; } case 3 { print "Program_erase\n"; $TESS_CONFG{"Pr +ogram_erase"} = $element; } case 4 { print "Configuration_and_Table_Files_erase\n"; $T +ESS_CONFG{"Configuration_and_Table_Files_erase"} = $element; } case 5 { print "Configuration_and_Table_Files_fetch\n"; $T +ESS_CONFG{"Configuration_and_Table_Files_fetch"} = $element; } case 6 { print "Create_Database\n"; $TESS_CONFG{"Cr +eate_Datebase"} = $element; } case 7 { print "Load_Database\n"; $TESS_CONFG{"Lo +ad_Datebase"} = $element; } } } ### Test it! my $hash_ptr = \%Program_fetch; print "$hash_ptr\n"; while ( ($key, $value) = each %{$hash_ptr} ) { print "$key => $value\n"; } my $hash_ref = $TESS_CONFG{"Program_fetch"}; print "Result: $hash_ +ref\n"; my @keys = keys %$hash_ptr; while ( ($key, $value) = each %{$hash_ref} ) { print "$key => $value\n"; } }