Hashes and arrays are your friend:
my @required_items = qw( apple orange pear ); foreach my $collection (@collections) { my %seen = (); foreach my $item ( ... ) { # however you get the items out of $colle +ction $seen{$item} = undef; } foreach my $item (@required_items) { if ( ! exists($seen{$item}) ) { # do something to insert it } } }
In reply to Re: are they all there?
by jhourcle
in thread are they all there?
by anadem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |