Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Is a integer or string.

by targetsmart (Curate)
on May 25, 2009 at 10:33 UTC ( #766005=note: print w/replies, xml ) Need Help??


in reply to Is a integer or string.

characters enclosed in "" or '' make a string, numbers otherwise.(other types also exist, but in this case we take only these two)
a string as well used as a number in some cases, and a number can be used as a string in some cases.
in your example, you used ==, in that case, the $value1 and $value2 even though it is a string it will be converted to relevant numbers and then it will be compared.
in case of eq, there will only be string comparison even you compare numbers.
'use strict' pragma can warn/help in those scenarios where you do == on string, etc. but by default perl converts your values internally according to the operator or the area of use

so this is how perl works, the programmer in his design has to differentiate and do the code appropriately.


Vivek
-- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://766005]
help
Chatterbox?
[Corion]: This time it's for the Duktape embedded Javascript engine, which would be nice to have IMO, but doesn't compile on Windows currently
[Corion]: I imagine it would be fun to have WWW::Mechanize:: Duktape, but I haven't seen a web browser written in Javascript yet, except the ones distributed with PhantomJs

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2017-03-27 11:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (319 votes). Check out past polls.