I have a problem applying this to a log where two out of three entries end before they start; that is, in which the start times are later than the corresponding end times

Assuming that's a mere glitch in posting, please help me understand your log format a bit better:

The answers to that last set of questions bear directly on how to attack the problem.

I'm also unclear why you feel Time::Local is inadquate (assuming the end times are later than the start times). ...from its documentation:

SYNOPSIS $time = timelocal($sec,$min,$hour,$mday,$mon,$year); $time = timegm($sec,$min,$hour,$mday,$mon,$year); DESCRIPTION This module provides functions that are the inverse of built-in pe +rl functions "localtime()" and "gmtime()". They accept a date as a six-element array, and return the corresponding time(2) value in s +econds since the system epoch (Midnight, January 1, 1970 GMT on Unix, for example). This value can be positive or negative, though POSIX onl +y requires support for positive values, so dates before the system's + epoch may not work on all operating systems.

So, split the date-and-time component of the log entry to feed to Time::Local for conversion to epoch-seconds; add 60 (or 59) to identify the one minute span (unless your log is a series of one minute spans, in which case, why do you need to worry about conversions?), and proceed.

As always, sample data and a clear description of your problem will help us to help you.

Moving on, and for a WAG only, it may be that using grep (grep), or regexen (perldoc perlretut, among others)and a hash will suffice for the word-counting aspect of your question... but that begs other questions often asked here: "What have you tried? Where's your code?"

Updated: restored (approximately) the section originally lost to a bad job of editing


In reply to Re: Problems in dates and time additions by one minute by ww
in thread Problems in dates and time additions by one minute by Survivor

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.