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

Re: Difference between == and eq

Thread Previous
From:
walter valenti
Date:
February 6, 2002 06:45
Subject:
Re: Difference between == and eq
Message ID:
3C6141EA.2090304@yahoo.it
....

eq: to use for the strings
= : to use in numeric contest.(if you = in string contest in every true).

If you don't know if are string or numerical use eq

    Walter

> Hello,
>
> I have a small question: what's the difference between == and eq?
>
> 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?
>




Thread Previous


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