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

From: Michael Fowler <michael@shoebox.net>
Date: Tue Aug 17 2010 - 16:32:09 AKDT

On Tue, Aug 17, 2010 at 02:14:09PM -1000, 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?

There are four false values: undef, 0, "0", ""

Everything else is true.

You do not compare to a value to determine true or false, you simply
test:

    if ($foo) { ... }

    unless ($bar) { ... }

    while ($baz) { ... }

    if (10 == 20) { ... }

Whether or not this means Perl has booleans depends on what you mean.
Perl clearly has the ability to test for true or false.

--
Michael Fowler
www.shoebox.net
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Tue Aug 17 16:34:08 2010

This archive was generated by hypermail 2.1.8 : Tue Aug 17 2010 - 16:34:08 AKDT