Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Perl on OSX > Re: Is there a ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 11 Topic 1001 of 1076
Post > Topic >>

Re: Is there a True Boolean type in Perl?

by merlyn@[EMAIL PROTECTED] (Randal L. Schwartz) Oct 16, 2007 at 12:25 PM

>>>>> ""Chas" == "Chas Owens" <chas.owens@[EMAIL PROTECTED]
> writes:

"Chas> On 10/15/07, Michael Barto <mbarto@[EMAIL PROTECTED]
> wrote:
>> As both Java and Javascript both have a 'true' and 'false' or Boolean
data type, is
>> there any interest in evolution of Perl to have a true Boolean. Or what
is the
>> preferred method to do this in Perl. The "C" programmers want me to use
"0"'s
>> and "1"'s.
"Chas> snip

"Chas> Perl 5 does not have a boolean type.  Perl considers the following
"Chas> things as false: any number that is equivalent to 0 (0.0, 0e0,
etc.),
"Chas> the string '0', the empty string, undef, or an empty list ( i.e.
()).

"The empty list" doesn't belong in that list.  Boolean forces scalar
context,
and the scalar version of () is simply undef, which you've already listed.
Unless you also want to add (undef) or (0) or ("") to your list as well,
which
are just as false, and for the same reason. :)

Yes, I know the third edition of the camel added this, but they were
wrong.
Please don't propogate the mistake.  No edition of the camel that I was in
charge of got this wrong. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
0095
<merlyn@[EMAIL PROTECTED]
> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!
 




 11 Posts in Topic:
Is there a True Boolean type in Perl?
mbarto@[EMAIL PROTECTED]   2007-10-15 13:27:26 
Re: Is there a True Boolean type in Perl?
chas.owens@[EMAIL PROTECT  2007-10-15 16:54:08 
Re: Is there a True Boolean type in Perl?
merlyn@[EMAIL PROTECTED]   2007-10-16 12:25:29 
Re: Is there a True Boolean type in Perl?
gblackburn@[EMAIL PROTECT  2007-10-15 17:25:23 
Re: Is there a True Boolean type in Perl?
jeremiah@[EMAIL PROTECTED  2007-10-15 23:59:55 
Re: Is there a True Boolean type in Perl?
mbarto@[EMAIL PROTECTED]   2007-10-15 18:20:22 
Re: Is there a True Boolean type in Perl?
douglist@[EMAIL PROTECTED  2007-10-15 19:40:19 
Re: Is there a True Boolean type in Perl?
trey@[EMAIL PROTECTED] (  2007-10-17 12:40:08 
Re: Is there a True Boolean type in Perl?
chas.owens@[EMAIL PROTECT  2007-10-16 05:55:15 
Re: Is there a True Boolean type in Perl?
chas.owens@[EMAIL PROTECT  2007-10-16 06:01:02 
Re: Is there a True Boolean type in Perl?
david@[EMAIL PROTECTED]   2007-10-16 16:19:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 0:33:46 CST 2008.