[aklug] Re: perl doesn't natively do booleans?????

From: Arthur Corliss <acorliss@nevaeh-linux.org>
Date: Tue Aug 17 2010 - 16:33:16 AKDT

On Tue, 17 Aug 2010, Lee wrote:

> Which just blows my mind. So obviously I'm missing something because that just makes no
> sense. What am I missing? How do you do conditionals? Or do you have to explicitly do
> the comparison? (answer is 'not so far, apparently') But to what?
>
> This stackoverflow just added to my confusion.
>
> http://stackoverflow.com/questions/1036347/how-do-i-use-boolean-variables-in-perl

Uh, you really can't have logic operations without boolean in any language.
Perl does do boolean operations natively you just have to know what equates
to boolean true/false given Perl's auto-typecasting feature.

The answer on the page is correct. Like anywhere else non-zero is true,
zero is false. Corner cases involving typecasts from null/strings/etc
to numbers are mostly obvious.

Give us an example of what you're trying to do and we can show you how to
code it. You'll find Perl very succinct.

         --Arthur Corliss
           Live Free or Die
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Tue Aug 17 16:33:24 2010

This archive was generated by hypermail 2.1.8 : Tue Aug 17 2010 - 16:33:24 AKDT