Hi all, I've been writing some code that parses text from different sources and puts the results into multiply nested hashes.  I've written some subroutines to manipulate those, but they're in different scripts, many of which I just slapped together, before I realized how stupid and stubborn I was for not putting into modules. It's been on my list to refactor those into a module, but I also figure there should be a module somewhere that does that that's probably well tested, and that I could learn from.  I looked on cpan, and the closest I could find is Hash-Filler, and that's, as the name implies, more about filling in the hash.  I figure filling in the hash for me is probably more specific to what I'm parsing, but I'm looking for a module to manipulate/search/print the results. 

For example, one thing that I have now that would be nice to generalize is to give a function a reference to a hash of keywords or other parameters, say name=Bob and food=apple, and get location of the hash elements as well as associated hash elements that meet that criteria. Data::Dumper shows the actual results, but doesn't allow this kind of search functionality, and I'd also like to be able to format the output (XML, csv, etc.).

Also, I know that having arrays is more efficient, but I need to be able to look up by the key. I know of various XML and CSV modules, but haven't found any for complex hashes. Anybody know of any such module?  

====================================================
Burvil * http://www.burvil.org *

In reply to Module for manipulating complex hashes? by bowei_99

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.