develooper Front page | perl.beginners | Postings from February 2002

Re: Difference between == and eq

Thread Previous | Thread Next
From:
Shawn
Date:
February 6, 2002 06:46
Subject:
Re: Difference between == and eq
Message ID:
037201c1af1c$c72d62b0$d800a8c0@work

----- Original Message ----- 
From: "wim" <wdh@belbone.be>
To: <beginners@perl.org>
Sent: Wednesday, February 06, 2002 8:39 AM
Subject: Difference between == and eq


> Hello,
> 
> I have a small question: what's the difference between == and eq?

== is a numeric compare

1 == 1

eq is a stringwise compare

a eq a

see perlop for more...

Shawn

> 
> When I do:
> 
> if ( $menuitem == "modify_router") {
>          print "Modify router<br>";
> } else {
>          print "Add router<br>";
> }
> 
> it doesn't work. But when I change it to:
> 
> if ( $menuitem eq "modify_router") {
> ....
> 
> It works!
> How comes?
> 
> -- 
> Kind regards,
> 
> Wim De Hul
> Belgacom Belbone
> --------------------------------
>   Mail   : wdh@belbone.be
>   Mobile : +32 479 952004
>   Ripe   : WDH25-RIPE
>   Registered Linux User: #260015
> --------------------------------
> 
> 
> -- 
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> 
> 
> 


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About