On Tue, 19 Aug 2003, Martin Bower wrote:

> is there a quick way for me to see if a value contained in %hash2 [after
> being mutated someway] exists in %hash1 ? without resorting to as nested
> loop foreach hash.

If you've got the memory (and looking at it, you're not dealing with too
many items yet, so you should have) it'd make more sense to precompute
each possible key from the keys in %hash1 once and store that in a
seperate hash, then all you'll need to do is look up the key from hash2 in
that hash.

Keep making the hashes bigger and bigger till you run out of physical
memory[1].  Hashses are fast.

Mark.

[1] Though if you run out of physical memory then everything suddenly gets
very very very very slow.

-- 
#!/usr/bin/perl -T
use strict;
use warnings;
print q{Mark Fowler, [EMAIL PROTECTED], http://twoshortplanks.com/};

Reply via email to