ybiC has asked for the wisdom of the Perl Monks concerning the following question:
Suggestions, o wise brethren and sistren?
#!/usr/bin/perl -w use strict; use Getopt::Long my ( $targ, $opt_targ, $firstport, $opt_firstport, $lastport, $opt_lastport, $proto, $opt_proto, $udptimeout, $opt_udptimeout, $contimeout, $opt_contimeout, $help, ); GetOptions( 'targ=s' => \$opt_targ, 'firstport=s' => \$opt_firstport, 'lastport=s' => \$opt_lastport, 'proto=s' => \$opt_proto, 'udptimeout=s' => \$opt_udptimeout, 'contimeout=s' => \$opt_contimeout, 'help!' => \$opt_help, ); if (defined $opt_targ){ $targ = $opt_targ } else {$targ='localhost';} if (defined $opt_firstport){ $firstport = $opt_firstport } else {$firstport=1;} if (defined $opt_lastport){ $lastport = $opt_lastport } else {$lastport=1024;} if (defined $opt_proto){ $proto = $opt_proto} else {$proto='tcp';} if (defined $opt_udptimeout){ $udptimeout = $opt_udptimeout } else {$udptimeout=3;} if (defined $opt_contimeout){ $contimeout = $opt_contimeout } else {$contimeout=3;} if (defined $opt_help){ Usage('You rang, sir?'); exit; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jcwren) Re: Reduce Redundant Repetition
by jcwren (Prior) on Jan 21, 2002 at 21:21 UTC | |
|
Re: Reduce Redundant Repetition
by kal (Hermit) on Jan 21, 2002 at 21:38 UTC | |
|
(tye)Re: Reduce Redundant Repetition
by tye (Sage) on Jan 21, 2002 at 22:08 UTC | |
|
Re: Reduce Redundant Repetition (Rus: use ternaries)
by Russ (Deacon) on Jan 22, 2002 at 00:08 UTC | |
|
Re: Reduce Redundant Repetition
by mrbbking (Hermit) on Jan 21, 2002 at 23:15 UTC | |
|
Re: Reduce Redundant Repetition
by Aristotle (Chancellor) on Jan 22, 2002 at 03:27 UTC |