How do I check scalar for an 'inf' value in Perl? [duplicate]
开发者_如何学CPossible Duplicate:
How do I create or test for NaN or infinity in Perl?
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?
精彩评论