>>>>> "EA" == Eitan Adler <li...@eitanadler.com> writes:

  >> Constants are usually written in all uppercase to distinguish them from
  >> keywords, functions, operators and subroutines.  How did you choose the
  >> arbitrary values 0 and 1 for false and true instead of using other values?
  >> Why did you name them false and true instead of zero and one?
  >> 

  EA> I changed them to uppercase. I call them TRUE and FALSE in order
  EA> to get the appearance of a Boolean construct.  In my opinion $var
  EA> = TRUE; is easier to read than $var = 1; I could have used any
  EA> arbitrary number that evaluates to true or false.

do you realize perl has 5 false values and rarely do you see constants
like TRUE??

these are all false:

0, 0.0, '0', '' and undef.

so defining a FALSE makes little sense if you could possibly get any of
those. also checking for a FALSE constant can be tricky. do you do $bool
== FALSE or eq FALSE? you need to know the type of FALSE for that.

perl style is to just use boolean tests and not check for equality to
some constants. and this means not using FALSE and TRUE constants. so
you should drop this habit as you won't see it much in perl. 

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to