in reply to Binary Search Timestamps

Howdy Paraxial, welcome to the Monastery!

Binary Searches on Sorted Text Files has a useful snippet of code for binary-searching text files. It's intended for sorted in its current state, but all you'd really need to do to adapt it to your needs is modify the conditions for the recursive calls. In fact, I'd pass a callback function there as an extra parameter instead of hardcoding anything specific.

One of the comments on that node also points out File::SortedSeek, which looks like it may well be useful.

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

    Thanks for this, I found the link to the page on binary searching sorted text files before I posted this, though failed to see the comment mentioning File::SortedSeek!

    You're right, it does exactly what I need and I've now managed to get it working with the log file as expected, so thank you!

    I've found I will probably run this script every 5-10 minutes in order to reduce the amount of RAM required to run this as it does get quite hungry.