January 2008 Archives

Some Perl

| No Comments | No TrackBacks
To see if @a is a subset of @b in Perl, use this:
  all(@a) == any(@b)

(all and any are exported from Quantum::Superposition)

I think it's brilliant that that it's very different from

  any(@b) == all(@a)

Which will be true only if all elements in @a are the same as anyone one element in @b. Quantum::Superposition is so brilliant but should really be renamed or aliased to some shorter name. Or can just be a part of "feature" pragma.