Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How to determine if something is numeric?

by kutsu (Priest)
on Jan 30, 2004 at 19:35 UTC ( #325353=note: print w/replies, xml ) Need Help??


in reply to How to determine if something is numeric?

Here's my take:

die "$var non-numeric" if $var =~ /[^0-9]/; #dies if it starts with - $var =~ s/^0*//; #this will remove any leading zeros

"Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (13)
As of 2021-04-16 12:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?