Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
XP is just a number
 
PerlMonks  

Re: Re: Re: Re: Re: Shorten script

by sauoq (Abbot)
on Jul 22, 2003 at 17:02 UTC ( [id://276921]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Re: Re: Re: Shorten script
in thread Shorten script

is the or a short circuit operator?

Yes. That code should work fine.

Now, if you take the final step and incorporate a ternary operator in the print statement, you'll have reproduced BrowserUk's version. :-)

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Aesthetics :)
by snax (Hermit) on Jul 22, 2003 at 17:42 UTC
    True, but I do so hate the ternary operator :)

    Well, that's not precisely true. With "complex" tests and returns I find it obfuscates the logic a bit (to my eye) -- truly a personal aesthetics issue.

    What I do like about BrowserUk's version is the use of $_; I should have noticed that right away. I'm slipping as work and hobby has kept me away from perl for too long. It's good to be back in the saddle again....

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://276921]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.