On 7/31/07, jeevs <[EMAIL PROTECTED]> wrote:
> Hello forum.
>
> I am here with a logical problem rather. I have a log file which will
> be huge in and can run in MBs.
> log file structure is like
>
> 2007-08-09,0,0,0,0,0,0
> 2007-08-11,0,0,0,0,0,1
> 2007-08-11,0,0,0,0,0,1
> 2007-08-12,0,0,0,2,3,2
>
> What I am supposed to do is show the data between particular date
> range.
> what I have thought so far is to get a two dates for range.
> then getting all the dates in between the range into an array and
> parsing each line to see if the date is there and print the record.
> But my mind says there might be some optimum solution to this.
>
> At first i tried to use record separator as the starting date but soon
> realized if the record to that particular date doesnt exist my program
> is dead.
>
> Right now I am unable to think of anything else.  If you can point me
> to any module or something logical I can do here . It would be
> helpful.
>
> -- nexis

Use timelocal* or mktime** to convert the dates to the integer number
of seconds since 1970.   After that it is a simple matter to see if an
integer falls within a given range.

* from the Time::Local module
**from the POSIX module

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to