源过滤器是坏的并且不应该在生产代码中使用是"常识" .
在回答类似但更具体的问题时,我找不到任何好的参考资料,清楚地解释了为什么过滤器是坏的以及何时可以安全使用.我想现在是时候创造一个了.
为什么在Perl 5.12中不推荐使用Switch模块?
我知道这是和switch/ case有关elsif,但我不太喜欢.
给出一个代码
use Switch;
my $var1x = "one";
switch ($var1x) {
case "one" { print "Why so small?\n"}
case "two" { print "Why so small?\n"}
case "three" { print "That is ok.\n"}
case "four" { print "That is ok.\n"}
}
Run Code Online (Sandbox Code Playgroud)
我想将类似案件的实施分组.有任何建议如何在Perl中正确编写它?