Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Does it look like a number?

by xdg (Monsignor)
on Dec 15, 2004 at 17:16 UTC ( #415114=note: print w/ replies, xml ) Need Help??

in reply to Does it look like a number?

Lots more on this topic came up recently. See Detecting if a scalar has a number or string, which includes a lot of discussion about how to treat objects that overload like numbers. I personally like Re^3: Detecting if a scalar has a number or string by davido, which ducks a lot of the issues and tests to see if a given input would generate a warning if used in arithmetic -- which is what I usually find myself wanting to check when I'm being given user input (as opposed to whether something is represented internally as a number or string).


Code posted by xdg on PerlMonks is public domain. It has no warranties, express or implied. Posted code may not have been tested. Use at your own risk.

Comment on Re: Does it look like a number?

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (12)
As of 2015-11-30 18:00 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (778 votes), past polls