Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things


by Juerd (Abbot)
on Jan 21, 2002 at 17:42 UTC ( #140385=note: print w/replies, xml ) Need Help??

in reply to

Why do you use TRUE and FALSE constants? Perl already has some sense of true and false ("", "0", 0 and undef are false, all other values are true).
If you ever need a representation in terms of 1 or 0, just use ?:.
$foo ? 1 : 0;
(Or the more evil !!$foo || 0 :))

2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

Replies are listed 'Best First'.
Re: Re:
by jryan (Vicar) on Jan 22, 2002 at 01:56 UTC
    While you are correct, (and I ++'ed ya), perhaps he is more familiar with another programming language where those constants do exist (such as java)? You have to admit that it does make the program easier to read, and easier to maintain for a non-native perl programmer. Thats not to say I'd do it myself, but if it helps Dave write code that he is more comfortable with, why not? TIMTOWTDI, right? :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://140385]
and a kettle whistles...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2017-06-25 01:17 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (564 votes). Check out past polls.