Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Reduce Redundant Repetition (Rus: use ternaries)

by Russ (Deacon)
on Jan 22, 2002 at 00:08 UTC ( [id://140477]=note: print w/replies, xml ) Need Help??


in reply to Reduce Redundant Repetition

I don't see anyone using the ternary operator...
$targ = defined $opt_targ ? $opt_targ : 'localhost'; $firstport = defined $opt_firstport ? $opt_firstport : 1; $lastport = defined $opt_lastport ? $opt_lastport : 1024; $proto = defined $opt_proto ? $opt_proto : 'tcp'; $udptimeout = defined $opt_udptimeout ? $opt_udptimeout : 3; $contimeout = defined $opt_contimeout ? $opt_contimeout : 3; Usage('<lurch>You rang?</lurch>'), exit if defined $opt_help;
And it still works with valid zero values.

Russ

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-25 14:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found