SPUG: 0 == undef

Peter Darley pdarley at kinesis-cem.com
Wed Apr 7 13:43:53 CDT 2004

	This doesn't pass the following test tho:

my $Test1 = 5;
my $Test2 = "5.0";
if ("$Test1" eq "$Test2") {print "OK\n"}
else {print "Crap!\n"}

Peter Darley

-----Original Message-----
From: Adrian Hands [mailto:AEH at akc.org]
Sent: Wednesday, April 07, 2004 11:39 AM
To: pdarley at kinesis-cem.com; spug-list at mail.pm.org
Subject: Re: SPUG: 0 == undef

if ("$Test1" eq "$Test2") {print "Crap!\n"}

>>> "Peter Darley" <pdarley at kinesis-cem.com> 04/07/04 02:26PM >>>
	I'm wondering if there's any way to get 0 to not equal undef.  When I do:

my ($Test1, $Test2) = 0, undef;
if ($Test1 == $Test2) {print "Crap!\n"}
else {print "OK\n"}

	I find out that 0==undef.
	I'm also wondering what the thinking here is?
Peter Darley

Seattle Perl Users Group Mailing List  
POST TO: spug-list at mail.pm.org  http://spugwiki.perlocity.org 
ACCOUNT CONFIG: http://mail.pm.org/mailman/listinfo/spug-list 
MEETINGS: 3rd Tuesdays, Location Unknown
WEB PAGE: http://www.seattleperl.org

More information about the spug-list mailing list