Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Is a integer or string.

by FloydATC (Deacon)
on May 25, 2009 at 11:20 UTC ( [id://766016]=note: print w/replies, xml ) Need Help??


in reply to Is a integer or string.

I usually just do an if ($n == int($n)) to check for numberness. Maybe there's a better way, I dunno... (obviously this doesn't work with floats)

Replies are listed 'Best First'.
Re^2: Is a integer or string.
by akho (Hermit) on May 25, 2009 at 14:47 UTC
    perl -e "print 'You should not.' if ('12ijlijlij' == int('12ihjlijlij'))"

    eq would work, however.

      No, int('12ihjlijlij') == 12, which is != '12ijlijlij'... uh.. or not.. Nevermind :o)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-04-16 10:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found