A few of my favourite things.... Set::Object

One module I discovered a few years ago, and seem to end up using for many things, is Set::Object by Sam Vilain.
Although this initially looks like a degraded hash - it holds a number of scalars and references - it comes with a whole batch of set operations (union, intersection, differences etc), and its fast.
Its also been consistently and carefully maintained, and Sam is a responsive maintainer.
Set::Object has been far more useful to me than I first expected, has preserved me from a ton of code mangling hashes to do the same operations, and is a really useful part of my toolkit.
The only downside is I mostly use it when working on billing related code at work - an occupation that does not fill me with joy :-/


I am also a fan of Set::Object. Sure, many of these operations can be implemented easily using map, but it seems silly to write them over, and over, and over...

I think a "set" should be a first-class data type, like lists, hashes, and strings.

Thanks. This post made my day.

Leave a comment

About Nigel Metheringham

user-pic Ancient hacker