http://www.perlmonks.org?node_id=229792

toma has asked for the wisdom of the Perl Monks concerning the following question:

I have a large array that contains sets of integers.
array[0]="1,100,105,1003"; array[1]="42,314,2718,30302"; etc...
I would like to save RAM with a more efficient representation of these sets. Here are a few facts about the numbers: The best answer might be to just use a database. I was thinking about a RAM-based solution in an attempt to get blazing speed in a mod_perl application. It would be nice if I could look up and decode about 100 of these rows in 0.05 seconds or so.

I would also like to be able to load these numbers into RAM relatively quickly, so I would like a data structure that can be stored and restored with Storable or some other quick method.

I am looking for ideas, pointers to algorithms, modules, or code. It seems like a fairly fundamental area of computer science, but I don't know what this area is called.

Thanks!

It should work perfectly the first time! - toma