http://www.perlmonks.org?node_id=840850


in reply to Help Perl Program - I have compilation errors don't know where

Another small note: Don't abuse the strings "false" and "true" as replacement for boolean values. It makes your code harder to maintain, and it is more work for perl. Worst of all, Perl consideres BOTH values as true. There are exactly three values that Perl treats as false: 0, '', and undef, and you really should use one of those, preferably the first or the second, instead of "false". All other values are treated as true, but except in rare cases, you should use 1.

So: replace "false" with 0 or '', replace "true" with 1. Replace $whatever eq "true" with $whatever, replace $whatever eq "false" with !$whatever.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^2: Help Perl Program - I have compilation errors don't know where
by cdarke (Prior) on May 20, 2010 at 08:48 UTC
    While I agree completely with the spirit of the reply, the pedant in me demands that I quote the following from perlsyn:

    The number 0, the strings '0' and '', the empty list (), and undef are all false in a boolean context.