Perl’s special not a numbers

Perl has some “numbers” that aren’t really numbers. Or, it has them if your underlying C library supports them.

The first, the “not a number”, is the string “NaN”, in any case. This isn’t a single value. The standard for floating-point numbers, IEEE 754. This value, which isn’t a number, returns itself in any mathematical operation. Continue reading “Perl’s special not a numbers”

A use for the scalar reverse (maybe)

The reverse operator, which turns a list end to front, has a scalar context too. It’s one of the examples I use in my Learning Perl classes to note that you can’t guess what something does in context. I’ve never had a decent example for a proper use, but flipping a string around to effectively scan from the right seems interesting. Continue reading “A use for the scalar reverse (maybe)”