RE: [Arsperl-users] Query Question
Brought to you by:
jeffmurphy
|
From: Mark V. <Mar...@ev...> - 2006-01-09 21:30:40
|
Perl is assuming, since you are using the '=3D=3D' that it is a numerical=
value.
=20
From Programming Perl, 2nd Edition, page 21:
1. Any string is true except for "" and "0".
2. Any number is true expect for 0.
3. Any reference is true.
4. Any undefined value is false.
=20
So if we define our terms based upon Perl's version of true and false we
get:
if( $PW is false ) {
print "Change PW\n";
} else {
Print "Can't Change PW\n";
}
=20
From Perl rules above, both 0 (value) and NULL (string?) or <undefined>
would execute the 'if' block. Anything else would execute the 'else'
block.
=20
THT,
Mark
=20
Mark Vaughan
Programmer III
=20
Direct: +1 303 802 2426
Cell: +1 303 601 4434
Fax: +1 303 802 1420
mar...@ev... <mailto:mar...@ev...>=20
Evolving Systems, Inc.=20
9777 Pyramid Court, Suite 100, Englewood, CO USA 80112
www.evolving.com
________________________________
From: ars...@ar...
[mailto:ars...@ar...] On Behalf Of Lintner, Mitchell
Sent: Monday, January 09, 2006 2:05 PM
To: ARSPerl
Subject: [Arsperl-users] Query Question
=20
I have a ARSPerl script that I am working with. I am trying to build a
condition off of the value of a Radio button field on a form. I want to
do something if the field in NULL. The field has a 0 and a 1 value.
I am having trouble. It seems that ARSPerl is assuming 0 to be the same
as NULL. Is this true or am I building me script incorrectly? He is the
condition I am using:
if ($PW =3D=3D "") {=20
print "Change PW\n"=20
} else {=20
print "Can't Change PW.\n"=20
}=20
I $PW is NULL or 0, I get the first response. If $PW is 1, I get the
second.=20
Thanks,=20
Mitch=20
Mitch Lintner=20
Analyst/Programmer=20
Remedy Developer=20
Cingular Wireless=20
1125 E Campbell Rd=20
Richardson, Texas, 75081=20
972-907-6965=20
mit...@sw...=20
This e-mail and any attachments may be confidential and/or legally privil=
eged. If you have received this e-mail and you are not a named addressee,=
please inform Evolving Systems TIS at ti...@ev... and then delete t=
he e-mail from your system. If you are not a named addressee you must not=
use, disclose, distribute, copy, print or rely on this e-mail. To ensure=
regulatory compliance and for the protection of our clients and business=
, Evolving Systems may monitor and read e-mails sent to and from its serv=
ers. Although Evolving Systems routinely screens for viruses, addressees =
should scan this e-mail and any attachments for viruses. Evolving Systems=
makes no representation or warranty as to the absence of viruses in this=
e-mail or any attachments.=20
Registered Office: 9777 Pyramid Ct Suite 100, Englewood, CO 80112
|