I am writing an object to act as a set (as in the Computer Science description). It main requirement is to be as slim and fast as possible. I have used a hash as the backing data structure because this allows me to enforce the 'no duplicates' property of sets.
So to add an element to the hash I just map it to undef as such:
$set{$item} = undef;One thing I want to do is combine two sets. Obviously this could be a real performance bottleneck and due to its intended use it is essential I combine the two backing hashes as fast as possible. Obviously I could use:
foreach $key (keys %set1) { $set2{$key} = undef; }
Is this the quickest way I can manage... or is there potentially a faster technique that anyone knows?
Thanks...
____________In reply to Fast Way to Combine Two Hashes by arunhorne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |