in reply to Checking whether a $var is a number

One issue that nobody has yet mentioned is the possibility of having objects that work as numbers thanks to overload. I guarantee that all of the regex solutions will fail miserably on this because they coerce to a string, not a number. These may be (as in the case of $!) radically different things...

Without a hook to the internal API, the only real solution is to try to use it as a number and see if Perl complains.

  • Comment on Re (tilly) 1: Checking whether a $var is a number