Sorry, my previous remark on .. and ... was silly. These operators won't help you here, since you don't know whether there actually is an entry in the log file with the very starting/ending times of the interval you are checking for.

In this case, I would proceed as follows:

Convert your string timestamp (2006-04-06 09:22:44) into a numeric value. You can do this forexample by extracting the respective fields by a regexp, and then use the functions in Time::Local to convert them into a time value. If you do the same with the starting/ending time, you can use numeric comparision to see whether the record falls within the range.

If you don't want to fiddle around with regular expressions (though in your case, they will be simple, because the timestamp always looks alike, doesn't it?), you could maybe use Date::Parse from CPAN. I have never worked with Date::Parse though, so I can't really say how useful it is for your application.

-- 
Ronald Fischer <ynnor@mm.st>

In reply to Re^3: Hi Perlmonks, I have need to write a script to do the following by rovf
in thread Hi Perlmonks, I have need to write a script to do the following by timvzid1

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.