in reply to Avoiding if/else knots II

When the order is not important you can insert "()" around the constant parts of the keys and match $m=join"|",keys%table;$code=~/$m/ then you can dispatch on ($m=~/|([^|]*$1[^|]*)|/)[1].