Data::Dumper showed me the way. What I had was not an "array of hashes". It was, as far as I can tell, an array containing one element, and that element was an array, containing the hashes.

I finally figured it out when I tried this on a hunch:

print "${${$diary_data[0]}[0]}{user}\n"; print "${${$diary_data[0]}[0]}{timestamp}\n"; print "${${$diary_data[0]}[0]}{value}\n";

which gave me some good output:

MAWEBB 988227105 NSA NOTIFY NETWORK MAINTENANCE 4/24/01 + 22:05 CST

From there, I was able to come up with:

$i=0; while (${${$diary_data[0]}[$i]}{user}) { print "User:\t\t${${$diary_data[0]}[$i]}{user}\n"; print "Timestamp:\t${${$diary_data[0]}[$i]}{timestamp}\n"; print "Information:\t${${$diary_data[0]}[$i]}{value}\n\n"; $i++; }

This gives me exactly the information I'm looking for. All that's left is munging it into a decent format for e-mail.

There are still some things I need to do with cleaning up this code, and I need to go back over exactly why this works the way it does, but I think I'm on the right track here. Thanks again Monks for the help today! :-)

Chumley

In reply to Got it, sort of (Re: Array of hashes problem) by chumley
in thread Getting information from an array of hashes by chumley

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.