Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

(tye)Re: Checking whether a $var is a number

by tye (Sage)
on Sep 05, 2001 at 00:46 UTC ( [id://110159]=note: print w/replies, xml ) Need Help??


in reply to Checking whether a $var is a number

If I can come up with so many different interpretations of "is this string an integer" ((tye)Re: Integer detection concept), just think how many interpretations of "is this string a number" covers.

First you need to decide which of the many meanings you are dealing with and then you can decide which of probably several ways you can try to get that answer. If someone offers to tell you how to determine is a string "is a number" without forcing you to be a lot more specific, then are likely answering the wrong question for you. (:

Though, I do think that Perl's internal looks_like_number() might be the right answer for several common meanings of that question. I really need to find the time to get an interface to that available from CPAN and included in a future version of the core. /:

        - tye (but my friends call me "Tye")
  • Comment on (tye)Re: 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://110159]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (8)
As of 2024-04-16 07:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found