I'm building a data structure from a config file that looks roughly like this (doing a single pass populating hash entries as they are encountered, not looking ahead):
# Define a page page <page key> { toolbar standard; }; # Define a standard toolbar toolbar standard { item { <item config> }; };

When I encounter toolbar standard; in the page config I want to create a blank hash key that will get filled later with the actual definition of toolbar standard. I've tried the following:

# Encounter the toolbar standard; line in the page config # Doesn't actually do anything $page->{<page_key>}{'toolbar'} = $toolbar->{'standard'}; # complains about standard getting re-defined $toolbar->{'standard'} ||= {}; # also tried undef and dummy value ins +tead of {} with no luck $page->{<page_key>}{'toolbar'} = $toolbar->{'standard'}; # $toolbar->{'standard'} is actually populated sometime after I proces +s $page->{<page_key>}

Is there any way to get the toolbar def in the page config point to a bucket that will be filled when the toolbar section is processed?


In reply to Defining a hash key for later use by amw1

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.