Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: 1 vs "1"

by Caillte (Friar)
on Sep 12, 2001 at 20:50 UTC ( [id://111953]=note: print w/replies, xml ) Need Help??


in reply to 1 vs "1"

A limited method, but one that could be built on is to use +0. Using an eval like the example below will return 0 if fed a string containing no numeric characters or the number 0 so, something like this could be a start:

foreach my $var ('0', '-112.04', 'qwerty') { $var2 = eval '$var+0'; if($var eq '0' or $var2) { print "Is an number\n"; } else { print "May not be an number\n"; } }

$japh->{'Caillte'} = $me;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-19 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found