Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 如何在 Perl 中创建或测试 NaN 或无穷大?
我如何检查标量是否具有inf价值?
inf
我将 NaN 检查为$scalar != $scalar,该怎么办inf?
$scalar != $scalar
$scalar == inf不起作用,因为inf是一个裸词
$scalar == inf
您可以使用它来检查无穷大:
$scalar < 9**9**9
这个常数太大了,以至于 Perl 将把它解释为无穷大
我现在发现了一个肮脏的黑客。
($scalar eq "inf")
有没有更清洁的东西存在?