Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Range in Getopt

by Discipulus (Priest)
on Oct 03, 2012 at 07:53 UTC ( #996998=note: print w/ replies, xml ) Need Help??


in reply to Range in Getopt

i usually do like this:

my $needed_param = 'need_default'; my $debug = 0; # default value numeric and not "" # getting params with getopt with a strict syntax # id est: if GetOptions fail may be better the program does NOT run at + all &help()if( ! GetOptions( 'needed=s' => \$needed_param, # [..] 'd=i' => \$_debug ) or ! $needed_param ); #then adjust values to a default or a maximum as needed $debug > 3 ? $debug = 3 : $debug ; sub help { "$0 -n [-d [0-3]] ... "}
hope this help
L*
there are no rules, there are no thumbs..


Comment on Re: Range in Getopt
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2015-07-03 10:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (51 votes), past polls