Actually, that's exactly what it was doing. The way your code was written, it would have inserted all the lines from the file into the hash(granted the nested while was reinserting that same hash values 10 times each). It was the line immediately after the foreach loop, as kabel already pointed out, which was resetting your your hash to just one key/value pair:

# This is the culprit! %member = ( $timestamp => [$current_time, $funds, $action, $current_fu +nds]);

That line was resetting the %member hash to the last values of $timestamp, et al. Removing that line would leave you with a hash with every line split and inserted. Now since you only wanted the last 10 lines, the for loop code I posted simply took an array slice from 0-9 and iterated over those, effectively letting the loop parse only the last 10 lines of the file.

Hope that clears things up a bit.


In reply to Re: Re: Re: Making a hash of making a hash of an array by pzbagel
in thread Making a hash of making a hash of an array by jonnyfolk

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.