Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical


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 the fog begins to lift...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2018-03-20 06:14 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (248 votes). Check out past polls.