, January 04, 2005 12:48 PM
To: beginners@perl.org
Subject: RE: How does defined work?
Both Zero 0 and empty string are defined values in Perl, so if you
want to test for values other than zero or empty string; then try something
like thing:
if ($nUserId) { # so 0, 0 or will fail here
Siegfried Heintze wrote:
How do I distinguish between no value and false? I thought defined was
supposed to do that.
defined is true if its defined and false if it is not defined
its defined if its been given a value that is defined as '' or 0..
Try this out, uncommenting the different my $foo's
Both Zero 0 and empty string are defined values in Perl, so if you
want to test for values other than zero or empty string; then try something
like thing:
if ($nUserId) { # so 0, 0 or will fail here
$juror_number = $nUserId;
} else {
die No valid ID for
Chris Devers wrote:
On Sun, 2 Jan 2005, Siegfried Heintze wrote:
I am posting this query in beginners instead of beginners-cgi because I
believe this is a question about the defined statement and not the $q-param
statement/function.
I'm using this code:
$q = new CGI;
my $nUserId
On Sun, 2 Jan 2005, Siegfried Heintze wrote:
I am posting this query in beginners instead of beginners-cgi because I
believe this is a question about the defined statement and not the $q-param
statement/function.
I'm using this code:
$q = new CGI;
my $nUserId =