How to do a range query

Posted by Walter H on Stack Overflow See other posts from Stack Overflow or by Walter H
Published on 2010-03-08T13:41:44Z Indexed on 2010/03/08 23:51 UTC
Read the original article Hit count: 299

Filed under:
|
|

I have a bunch of numbers timestamps that I want to check against a range to see if they match a particular range of dates. Basically like a BETWEEN .. AND .. match in SQL. The obvious data structure would be a B-tree, but while there are a number of B-tree implementations on CPAN, they only seem to implement exact matching. Berkeley DB has the same problem; there are B-tree indices, but no range matching.

What would be the simplest way to do this? I don't want to use an SQL database unless I have to.

Clarification: I have a lot of these, so I'm looking for an efficient method, not just grep over an array.

© Stack Overflow or respective owner

Related posts about perl

Related posts about data-structures