in reply to Re: Checking lots of conditions...ORed and ANDed
in thread Checking lots of conditions...ORed and ANDed
sub get_menu_items { my ($rules,@conditions) = @_; my %results; for my $cond ( @conditions ) { next unless exists $rules->{$cond}; for $item ( @{$rules->{$cond}->{allows}} ) { $results{$item}++; } } for my $cond ( @conditions ) { next unless exists $rules->{$cond}; for $item ( @{$rules->{$cond}->{disallows}} ) { delete $results{$item}; } } return keys %results; }
--
You said you wanted to be around when I made a mistake; well, this could be it, sweetheart.
|
|---|