Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Help Perl Program - I have compilation errors don't know where

by afoken (Parson)
on May 20, 2010 at 04:43 UTC ( #840850=note: print w/ replies, xml ) Need Help??


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". ;-)


Comment on Re: Help Perl Program - I have compilation errors don't know where
Select or Download Code
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://840850]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2014-09-22 01:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (176 votes), past polls