in reply to Testing for 16 possible combinations with 4 pull-down menus

Let's do this top-down.

if (valid_state($pull_downs) && $start_time < $end_time) { # okay; put processing here } else { # not okay: yell at user. }

For this to work, we need to satisfy some conditions. First, we need to bump all the pull-downs together; and second, we need the start and end times to be in some comparible format. Fortunately, these are both easy tasks. Then we have to write the valid_state functions, which isn't hard either.

# put this before the if mentioned above my $pull_downs = join "", $pull_down1, $pull_down2, $pull_down3, $pull +_down4; # or, if you're using CGI.pm, something like this: my $pull_down = join "", map { $query->param("pull_down$_") } 1 .. 4; # (whatever works; just mash them together. $pull_downs now looks like + your binary numbers. # And this returns true only if the number is one of your valid ones: { my $valid = qr/^(0000|1000|1010|1100|1111)$/; sub valid_state { return shift =~ $valid; | }

You may need to do a little extra work to binarify the data from the pull-down to your internal format, but that shouldn't be too daunting by now. As for the times, a good way of making them compatible is to translating them (say, with DateTime) to epoch seconds. These are simply two numbers, the bigger one represents a later time.