How do I create or test for NaN or infinite values in Perl?
Use Data::Float from CPAN. It exports the following functions:
float_is_infinite(
float_is_nan()
And contrary to the others half-working solutions posted here, it has a testsuite.