eh? How does being force to use $_ add opportunities for optimization?Theoretically the fact that there are several comparisons allows to make comparison to $_ with long strings faster (say more then 64 characters long). If the switch contains several "when" branches with string constants you can pre-compute hash of them and first compare a hash of $_ with hash of the constant and only if hash matches perform full comparison: you need to compute a single hash of $_ for all comparisons. If all "when" branches represent search without meta characters you can pre-compute a table via Knuth-Morris-Pratt for strings search.
In reply to Re^2: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
in thread What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff by likbez