On Oct 15, 2007, at 4:27 PM, Michael Barto 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.
In my experience the most common convention is to use undef and 1 as
your boolean values, as in:
my $is_scared; # is_scared is initially set to undef, which
evaluates as "false"
if ($monsters_under_my_bed) {
$is_scared = 1;
}
Yeah, it's probably bad karma to use "undef" when you mean "0" but
this approach is very perl-ish, easy to read, and even recommended by
Damian Conway in his "Perl Best Practices" book (page 40... just
checked. :-D)
---
Gary Blackburn
[EMAIL PROTECTED]