I still don't want to have to construct a table with around, say, 60 combinations of which only around, say, 20 are distinct.I'd also take the approach to normalize the 60 posibilities, i.e. coerce them into unique keys in the dispatchtable, with e.g.
and finally dispatch via a table$key = 'default'; $case =~ s/$reg2// && ($key = 'a'); $case =~ s/$reg1// and do { whatever(); $key = 'b' }; ...
$dispatch{$key}->(@args);
Can anyone see any possible drawbacks to this approach?
Not yet, since neither context nor implementation are visible...
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re: Avoiding if/else knots II
by shmem
in thread Avoiding if/else knots II
by loris
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |