Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How to determine if something is numeric?

by ysth (Canon)
on Jan 30, 2004 at 19:38 UTC ( #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
Node Status?
node history
Node Type: note [id://325355]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2021-04-15 05:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?