Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by tilly (Archbishop)
on Sep 06, 2001 at 00:22 UTC ( [id://110412]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://110412]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-04-24 06:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found