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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.