in reply to are they all there?

Is your collection an array-like (not keyed) or hash-like (keyed)? If your collection is hash-like, this would be trivial.

my @must_haves = qw( apple orange pear ); foreach my $collection (@collections) { foreach my $must_have (@must_haves) { $collection->{$must_have} = ... if not exists $collection->{$must_have}; } }

If your collection is array-like, it's simplest to create a hash from it. See jhourcle's reply for an implementation.

Replies are listed 'Best First'.
Re^2: are they all there?
by anadem (Scribe) on Aug 22, 2006 at 17:06 UTC
    thank you both -- the collections are array-like so I'll use jhourcle's suggestion. (I'm a perl novice, and have been away from perl for 18 months too, so wheels quite rusty -- thanks for helping get them moving!)