RE: [Arsperl-users] Query Question
Brought to you by:
jeffmurphy
|
From: Lintner, M. <mit...@ci...> - 2006-01-09 22:27:38
|
I think I have some understanding of what is going on but I think I
define $PW when I do this
=20
$PW =3D "$vals{$fields{'PW'}}";
=20
This brings back a NULL or a 0 or a 1 form the form I'm querying. If I
understand what is going on this defines the variable and leaves me with
no way to tell the difference between NULL and 0.
=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
=20
________________________________
From: ars...@ar...
[mailto:ars...@ar...] On Behalf Of Mark Vaughan
Sent: Monday, January 09, 2006 4:10 PM
To: ars...@ar...
Subject: RE: [Arsperl-users] Query Question
Mitch,
Since ARSPerl returns an undefined value for NULL,
if( !defined( $PW )) {
=20
Try something like this:
=20
if( !defined( $PW )) { # no radio element is selected
print "No element selected\n";
} else { # an element is selected
print "Element $PW is selected\n";
}
=20
HTH,
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:35 PM
To: ars...@ar...
Subject: RE: [Arsperl-users] Query Question
=20
Is there any way in Perl to distinguish a difference between a value of
Null and a value of 0 (zero)?
=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
=20
=20
________________________________
From: ars...@ar...
[mailto:ars...@ar...] On Behalf Of Mark Vaughan
Sent: Monday, January 09, 2006 3:30 PM
To: ars...@ar...
Subject: RE: [Arsperl-users] Query Question
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
privileged. 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 the 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 servers. 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.
Registered Office: 9777 Pyramid Ct Suite 100, Englewood, CO 80112=20
This e-mail and any attachments may be confidential and/or legally
privileged. 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 the 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 servers. 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.
Registered Office: 9777 Pyramid Ct Suite 100, Englewood, CO 80112=20
|