|
|
| Syntactic Confectionery Delight | |
| PerlMonks |
Re: Idiom: hashes as setsby TGI (Vicar) |
| on Jul 03, 2008 at 01:30 UTC ( #695265=note: print w/ replies, xml ) | Need Help?? |
|
This is a great idea. In fact, its such a great idea that its been done many times before. :) You've definitely hit on a useful technique. This is pretty similar to recipe 4.8 in the Perl Cookbook 1st edition.
Here's my implementation with each operation calculated separatly.
If I was doing a whole lot of set manipulation I'd look for a library that provides a complete suite of set theoretic operations--like Set::Object or Set::Scalar. For simple uniqueness, I'd probably stick with List::MoreUtils--some of its other functions like 'any' and 'all' offer such great readability improvements to my code that I have come to rely on it.
In Section
Meditations
|
|
||||||||||||||||||||