Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: eq vs. ==

by liz (Monsignor)
on Jul 20, 2003 at 10:32 UTC ( #276023=note: print w/ replies, xml ) Need Help??


in reply to eq vs. ==

Maybe this answers your question:

$val eq '2'
String compare string value of $val with string '2'.

$val == '2'
Convert string '2' to number, and numerically compare with numeric value of $val

$val == 2
Compare numeric 2 with numeric value of $val

If a string starts with a number, its numeric value will be that number. Consider the following examples:

$ perl -e "print 'a' == 'b'"
True because 0 == 0

$ perl -e "print 'a' == '1b'"
Not true because 0 != 1

$ perl -e "print 'a' == 'b1'"
True because 0 == 0

Liz


Comment on Re: eq vs. ==
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2015-07-08 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls