Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: ternary operator ?

by tommyw (Hermit)
on Nov 29, 2002 at 10:38 UTC ( [id://216474]=note: print w/replies, xml ) Need Help??


in reply to ternary operator ?

For a less esoteric example:

$apples=3; $oranges=1; print "I have $apples ", $apples==1?"apple":"apples", "\n"; print "I have $oranges orange", $oranges==1?"":"s", "\n"; __END__ I have 3 apples I have 1 orange

--
Tommy
Too stupid to live.
Too stubborn to die.

Replies are listed 'Best First'.
Re: Re: ternary operator ?
by sulfericacid (Deacon) on Nov 29, 2002 at 11:19 UTC
    Out of all the examples here, your's was definately the most understandable :) Thanks for trying to keep it basic and using something which would be a pretty practical use of it! I think I understand it more, thanks for your help!!

    sulfericacid

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-19 04:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found