hi
i have a dataset consisting of an array of arrays.
$data = [
[q_beg1, q_end1, s_beg1, s_end1]
[q_beg2, q_end2, s_beg2, s_end2]
[q_beg3, q_end3, s_beg3, s_end3]
...
]
q_beg, q_end, s_beg, s_end are all integers.
now, i would like to find all rows where q_beg and q_end are within one
interval (int1_beg, int1_end) while s_beg and s_end are within another
interval (int2_beg, int2_end).
this can be done with grep:
grep {$_->[0] < int1_beg and $_->[1] > int1_end and
$_->[2] < int2_beg and $_->[3] > int2_end} @$data;
however, this is too slow for my purpose. so how to speed up such
selection?
the query would be simple enough in a relational database, however i
want to avoid using a database using tables on disk.
i should think this was a pretty generic problem.
ideas are most welcome !
best regards
martin
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>