开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜