Thanks for everyone's suggestions.

thraxil suggested that misused array's might be my problem. It seemed a good place to start

My goal is to save an array reference which contains, at most, 10 datapoints. Every 60 seconds I get the array reference and add to it (dropping older off first)

In addition to knowing if there is a problem in the code, I would appreciate "coding" suggestions as I am new to Perl.

my @tmp; my $cur_qty; if (!defined $Output{"host"}) { $cur_qty = 0; } else { @tmp = @{$Output{"host"}}; $cur_qty = @tmp; } if (!$cur_qty) { # No saved data, just assign it $tmp[0] = $data; } elsif ($cur_qty >= 10) { # Remove oldest shift @tmp; # Add newest push @tmp, $data; } else # Just append it { push @tmp, $data; } # Save it $Output{"host"} = \@tmp;

In reply to More on: memory usage/leaks by smackdab

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.