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:
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |