in reply to
Fast seeking in a large array of hashes to generate a report.
First, you might consider using a relational
database (SQLite, MySQL, ...) - that's what
they're for, eh?
Second, if you really want to code it yourself,
and depending on how large the menu of possible
selections is, you could generate lookup hashes
ahead of time. If, for example, you have 200 possible
surnames and 50 possible ages, then you could generate
a hash with keys 'surname-age' (e.g. 'smith-25') whose
values are something like a reference to a list of indices into @Persons (e.g. [ 10, 102, 145, ... ] ). Seems like a classic "space-vs-speed" trade off.
An intermediate approach might be to somehow cache the
results of each filter loop,
so that the slow part only happens once.