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.


In reply to Re: Testing for 16 possible combinations with 4 pull-down menus by gaal
in thread Testing for 16 possible combinations with 4 pull-down menus by softcotton

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.