http://qs321.pair.com?node_id=39508

PsychoSpunk has asked for the wisdom of the Perl Monks concerning the following question:

Greetings,

I've got what may amount to a simple question, but I cannot recall seeing anything like this before around here. (And I will admit that I'm not quite sure what other words to send into the search box to fully find anything even mildly related.)

So, here's my current code:

$byte = ''; if ($obj->{organization} =~ /^\s*$/) { $byte .= '0'; } else { $byte .= '1'; } ... if ($obj->{report} =~ /^\s*$/) { $byte .= '0'; } else { $byte .= '1'; }
Extra details, the ... represents 6 more statements like the ones I have entered. All 8 checks are done to build a byte to check against a truth table as such:
if ($byte =~ /1(0|1){3}0{3}(0|1)/) { do more checks against database } elsif ($byte =~ /0{4}1(0|1)0{2}/) { do other checks against database } else { produce error message }
What I want to do, is (unless I'm doing it the most efficient way, which I don't think I am) find a better way to build that byte. Nonetheless, I figured it would be nice to see a real world application of discrete mathematics.

ALL HAIL BRAK!!!