I’m a little surprised (and scared) by the fact that the warnings pragma doesn’t complain about ‘NaN’ and ‘nan’ being non-numeric.
Why does warnings not emit the customary 'Argument isn't numeric in addition (+) for them?
Test Case
$ perl -Mstrict -wE 'say 0+$_ for qw/string NaN nan fail/;'
Argument "string" isn't numeric in addition (+) at -e line 1.
0
0
0
Argument "fail" isn't numeric in addition (+) at -e line 1.
0
From perlop
NaN behaves different on different platforms. It is in a way numerical as it can act as such in numerical operations. But it is also really not a number as it has undefined value.
Furthermore its behaviour is not portable as:
could yield different results on different platforms unless you use Perl 5.22 or newer.