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"; } }

In reply to Dereferencing Mystery by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.