in reply to bit-wise
I think that I would splurge a little on memory and use a hash (or maybe an array if the names are really '1' .. '9'). All the operations you want are easy and straightforward with a hash:
my %state; @state{1..9}=();
$state{$name} = undef;
@state{@names} = (1) x @names;
my $count = grep {$_} values %state;
my $setname = (grep {$state{$_}} keys %state)[0];
my @setnames = grep {$state{$_}} keys %state;
# same as ordinary perl print $foo if $state{$one} && $state{$tother};
Fixed typo in #2, thanks blokhead++
After Compline,
Zaxo
|
|---|