为什么在 Perl 中不推荐使用 Switch 模块? [英] Why is the Switch module deprecated in Perl?

查看:41
本文介绍了为什么在 Perl 中不推荐使用 Switch 模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么 Switch 模块 已在 Perl 5.12 中弃用?

我知道 switch/case 是用 elsif 制作的,但我不太喜欢那样.

I know that a switch/case be made with elsif, but I don't like that very much.

推荐答案

Perl 5.10 引入了一个真正的开关称为 given-when

Perl 5.10 introduced a real switch called given-when

旧的 Switch 使用了 源过滤和其他限制.

The old Switch used source filtering and had other limitations.

这篇关于为什么在 Perl 中不推荐使用 Switch 模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆