开发者

How do I check scalar for an 'inf' value in Perl? [duplicate]

开发者 https://www.devze.com 2022-12-19 21:31 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicate: How do I create or test for NaN or infinity in Perl?
This question already has answers here: Closed 12 years ago.

Possible Duplicate:

How do I create or test for NaN or infinity in Perl?

开发者_如何学C

How can I check, if scalar holds inf value?

I check NaN as $scalar != $scalar, what to do with inf?

$scalar == inf does not work, since inf is a bareword


you can use this to check for infinity:

$scalar < 9**9**9

that constant is so large that it will be interpreted as infinite by Perl


I found a dirty hack right now.

($scalar eq "inf")

Does anything cleaner exist?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号