http://www.perlmonks.org?node_id=136315


in reply to Why I Hate Nested If-Else blocks

While nested if statements look a mess, the unfortunate truth is that this is really the way decisions are made by humans.

If my car starts, I'll go to work, If net nets up, I'll check email and read PM, If there's a good thread, I'll read it, etc. . . . ..

The problem with a one-dimensional dispatch table, is that the operations in the outermost nests need to be replicated into much of the table entries, which require programatically building complicated hashes, futhur sacraficing readability.

I'm not sure how to build a "multi-dimensional" dispatch table where say the "rows" have one set of functions and the "columns" have another, without programatically building the subroutines.

say $daysactions{$morning_situation}{$afternoon_situation}=\&listofstufftodotodaygivenmorningandafternoonsituations;

Any ideas?

drinkd