His code has changed, and so has the error. Here was my original comment:

What? Am I missing something here? It seems that there are two major flaws in this:

1. I think that the comparison is backwards. If $y >= $start_y then the record is newer (not older) than the date 90 days ago.

2. The date comparison strategy is all wrong. Would Nov. 3 come before Oct. 6, just because 3 <= 6?

Update: And all of this assumes that there are no problems using localtime's month (zero-based) and year (minus 1900) to compare to the records...

About the next version of the code:

Is this method of comparing dates supposed to work in Perl? Not in my version, it doesn't. The dates '2001-10-06' and '2001-11-03' will be EQUAL in a numeric comparison. Numerically, they're both equal to 2001.

And finally...

Yes. This version will do nicely. I made davorg work pretty hard for my ++ this time...

buckaduck


In reply to Re: Re: Comparing Dates With a Twist by buckaduck
in thread Comparing Dates With a Twist by suggus

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.