First, consider moving this question to the tail of your previous thread. That would maintain the flow of the conversation.

The code ref in question,

(Delta_Days($3, $months{$1}, $2, $today[2], $today[1], $today[0]) > 30 + )? push @log_lines, $line : keep_line($line);
is asking
date_diff > 30 ? move_line : keep_line
which could be restated as
if(date_diff > 30) { move_line; } else { keep_line; }
That's what the ?: operator does. Delta_Days returns the number of days between two dates. So the > comparison to 30 fits your original request of finding timestamps more than a month old. [1]

Make sense?

[1] That is if you wish to follow the common convention that a month equals 30 days. If you need to do something like anything less than the current day of month in the previous month you'll need a different test.

Be Appropriate && Follow Your Curiosity

In reply to Re: Date::Calc Question by mikeraz
in thread Date::Calc Question by Anonymous Monk

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.