in reply to Binary Search Timestamps

Hello Paraxial, and welcome to the Monastery!

Since you will need the data from all the logs up to an hour old, you don’t really need a binary search. Just read the file backwards until the latest record read is more than an hour old. I haven’t used it, but the module File::ReadBackwards is designed for just this task:

This module reads a file backwards line by line. It is simple to use, memory efficient and fast. ...
It is intended for processing log and other similar text files which typically have their newest entries appended to them.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: Binary Search Timestamps
by Paraxial (Novice) on Jul 16, 2014 at 15:28 UTC

    I did in-fact look at this method yesterday, and it does seem to be a good way to do this vs binary searching, especially when working with things like log files.

    With that said, the File::SortedSeek module seems to be a better fit for what I'm doing it seems, though thanks for your input. As a complete newbie to Perl, it's nice to see I didn't go too far off the mark when looking for a solution to this.