in reply to Re^5: Avoiding if/else knots II
in thread Avoiding if/else knots II

It wasn't my idea. I took it from "Programming Perl" by Wall, Christiansen & Schwartz. Chapter 2: You might think it odd to write a loop over a single value, but a common idiom for a switch statement is to use foreach's aliasing capability to make a temporary assignment to $_ for convenient matching.


s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e