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

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
there are no rules, there are no thumbs..

Comment on Re: Range in Getopt
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996998]
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
Find Nodes?
    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