perl 智能匹配操作符的版本问题

问题:

perl v5.26.1运行含有智能匹配符的源代码,提示如下报错

Smartmatch is experimental at test.pl line 1.

解决方案1:

在源代码的开头添加如下语句

no warnings 'experimental::smartmatch';

解决方案2:

使用experimental模块

#use experimental 'smartmatch';

问题出现的原因:

智能匹配操作符存在bug, 需要谨慎使用,新版本自动警告,降低版本或者添加上述语句。

原文地址:https://www.cnblogs.com/xudongliang/p/12103274.html