Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: A function to determine if a string is numeric

by toolic (Chancellor)
on Feb 24, 2012 at 00:46 UTC ( #955847=note: print w/ replies, xml ) Need Help??


in reply to A function to determine if a string is numeric

Scalar::Util::looks_like_number

This is also a FAQ: perldoc -q number

use warnings; use strict; use Scalar::Util qw(looks_like_number); my $s = shift; if (looks_like_number($s)) { print "$s is a number\n"; } else { print "$s isn't a number\n"; }


Comment on Re: A function to determine if a string is numeric
Select or Download Code
Re^2: A function to determine if a string is numeric
by juliosergio (Acolyte) on Feb 24, 2012 at 00:56 UTC

    Hey! Thanks!
    -Sergio

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2014-10-01 15:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (29 votes), past polls