in reply to C++ style boolean type in Perl?

Mostly it is useless, and it is potentially dangerous if you are used to C++ booleans. C++ has only one false value, so:
if (x == FALSE)
will work every time. However, in Perl you have:
if ($x == $false) if ($x eq $false)
How do these work? What if $x = 0? or ''? or undef or 0.0? Are you sure? Perl has mutliple false values, so switching to a single false value is just asking for trouble.
Perl is perl, don't try to redefine the language. It is like the Pascal programmer who starts all his C code with:
#define BEGIN { #define END }
Server no purpose, confusing to others, and it just begging for weird ass bugs.

Replies are listed 'Best First'.
Re^2: C++ style boolean type in Perl?
by esharris (Monk) on Nov 20, 2005 at 11:32 UTC
    IMHO, adding these 2 constants in Perl is not redefining the language. The resulting script still looks like Perl. I've use these 2 constants in my scripts and I think using them enhances readability.