I have a Hash of Hashes created from a configuration file. In my program I first iterate over the hash to check for grammatical correctness as the rules in my program set forth. Upon finding incorrect rules in the has of configuration data I flag the hash entry for deletion. After this loop I delete the invalid entries from the hash.

Next I iterate over the hash again, this time checking that the rules that matched in grammer are correct in content. Things like files named in the config file exist, things named as directories are indeed directories etc. While doing this I again flag invalid entries to be deleted from the hash. When exiting this loop I delete the flagged entries from the hash.

Now I have a hash that contains rules checked for grammer and content. I can now iterate over the hash AGAIN and process the remaining rules.

Ok, here's the deal. Because I am in a loop in the lower level of the HoH I do not want to delete the hash entry until I am out of the processing loop, that's why I flag the entry then delete it afterward. What I would like opinions on is this:

Should I keep each of these functions as seperate functions and keep iterating over the hash each time I need to access the data or should I combine this into a single larger function and operate as follows?

Iterate over the hash and check grammer on each entry, if the grammer is correct, check for valid content in that particular entry. Once each 'rule' has been checked for grammer and validity process that rule ( I have defined actions for each rule type ). After processing the single rule, check the next rule for grammer and validity then process it, etc?

K, fire away, I can take it.


In reply to Request opinions and ideas by gnu@perl

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.