http://qs1969.pair.com?node_id=308981


in reply to A (memory) poor man's <strike>hash</strike> lookup table.

However, loading the same 1 million integers into a hash as keys, with undef as the value requires 95 MB!
I stopped reading there. I don't see your point. Besides storing all the data, you now have a meta-data structure that can tell you rather rapidly if $x is a member of this set you've created, as well as associate another scalar with each of those million keys!

You've got a lot more information than what you started with. You're not merely storing the keys.

If your complaint is that you want to be able to just store the keys, then yes, a hash was a bad choice, as you go on to point out.

But don't fault Perl's hash structure. It's very efficient for the task at hand.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.