Use a hash as a state table.

You'll have to fill in how you get your 0s and 1s and concatenate them, and getting your times into comparable format (seconds since...).

#! perl -slw use strict; my %states = ( 0000 => 1, 0001 => 0, 0010 => 0, 0011 => 0, 0100 => 0, 0101 => 0, 0110 => 0, 0111 => 0, 1000 => 1, 1001 => 0, 1010 => 1, 1011 => 0, 1100 => 1, 1101 => 0, 1110 => 0, 1111 => 1, ); my $state = ....; ## Get state from wherever? if( $states{ $state } ) { ## Validate values my( $startTime, $endTime ) = ...; ## Get times if( $startTime < $endTime ) { ## Do it } else { ## Reject. } else { ## Reject. }

BTB. If specifying just start and end hour is valid, why isn't specifying start hr/min and just end hr (1110) also valid? Eg. Start:10:45 * End: 11


Examine what is said, not who speaks.        The end of an era!
"But you should never overestimate the ingenuity of the sceptics to come up with a counter-argument." -Myles Allen
"Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo         "Efficiency is intelligent laziness." -David Dunham
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

In reply to Re: Testing for 16 possible combinations with 4 pull-down menus by BrowserUk
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.