Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: How to determine if something is numeric?

by ysth (Canon)
on Jan 30, 2004 at 19:38 UTC ( [id://325355]=note: print w/replies, xml ) Need Help??


in reply to How to determine if something is numeric?

That actually looks pretty good. It will show non-numeric for leading/trailing spaces that perl will usually ignore. Only problem I can think of is that it may report non-numeric for something like "100000000000000000000" (because it will turn into 1e20).

When deliberately ignoring a warning, I like to isolate it to the particular warning and operation involved, like:

my $testvar = do {no warnings "numeric"; $var + 0};

Log In?
Username:
Password:

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

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

    No recent polls found