Actually thinking about it, it is actually comparing it as strings except
for rounding off (seeing that it is a numeric literal) and then realizing
that it is a string comparison it converts back and finds them equal. (I
did some research with the foll:
if (0 eq "abc") {
print '(0 eq "abc")'."\n";
}
if (9.0 eq "9.0") {
print '(9.0 eq 9)'."\n";
}
)
Btw I'm not sure whether this is the right forum to ask such questions.
Would someone pls point me to where I can ask such questions, if so.
Tks&Rgds
Dr
At 04:59 PM 7/2/2001, Ben Wheeler wrote:
>That makes more sense (The other version produced no output as expected).
>You are comparing 9.0 to 9 as numbers instead of as text. They will be
>equal in that sense even though you are using the eq instead of ==
>comparison operator.
>
>Ben
>
>At 04:17 PM 7/2/01 -0700, David Rego wrote:
> >Darn I shouldn't have done this - my mistake guys. Sorry. :( (I gotta be
> >more careful.)
> >
> >Actually:
> >if (9.0 eq 9) {
> >print '(9.0 eq 9)'."\n";
> >}
> >
> >caused that printing. I guess that is the behavior of Perl and not
>ActivePerl.
> >
> >At 04:04 PM 7/2/2001, Frank Novak wrote:
> >>I don't see this behavior, same version of perl.
> >>
> >>
> >>
> >> -----Original Message-----
> >>
> >> From: David Rego
> >>
> >> Sent: Mon 7/2/2001 4:02 PM
> >>
> >> To: [EMAIL PROTECTED]
> >>
> >> Cc:
> >>
> >> Subject: Newbie question
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> Hi,
> >>
> >>
> >>
> >> Admittedly I'm not an advanced programmer in Perl, but I
> >>
> >>couldn't
> >>
> >> understand why:
> >>
> >>
> >>
> >> if ('9.0' eq '9') {
> >>
> >> print '("9.0" eq "9")'."\n";
> >>
> >> }
> >>
> >>
> >>
> >> cause the printing of:
> >>
> >>
> >>
> >> ("9.0" eq "9")
> >>
> >>
> >>
> >> in ActivePerl v5.6.1 built for MSWin32-x86-multi-thread build
> >>
> >>626.
> >>
> >>
> >>
> >> Tks
> >>
> >>
> >>
> >> Dr
> >>
> >>
> >>
> >>
> >>
> >> < http://www.Regos.net>
> >>
> >> < http://www.NikitaRego.com>
> >>
> >>
> >>
> >> _______________________________________________
> >>
> >> ActivePerl mailing list
> >>
> >> [EMAIL PROTECTED]
> >>
> >> http://listserv.ActiveState.com/mailman/listinfo/activeperl
> >>
> >>
> >>
> >>
> >>
> >>_______________________________________________
> >>ActivePerl mailing list
> >>[EMAIL PROTECTED]
> >>http://listserv.ActiveState.com/mailman/listinfo/activeperl
> >
> ><http://www.Regos.net>
> ><http://www.NikitaRego.com>
> >
> >_______________________________________________
> >ActivePerl mailing list
> >[EMAIL PROTECTED]
> >http://listserv.ActiveState.com/mailman/listinfo/activeperl
> >
> >
>_______________________________________________
>ActivePerl mailing list
>[EMAIL PROTECTED]
>http://listserv.ActiveState.com/mailman/listinfo/activeperl
<http://www.Regos.net>
<http://www.NikitaRego.com>
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl