in reply to deriving usage from Getopts::Long
As for addressing the redundancy of declaring variables and then retyping the option names in the Getopt call, an alternative use of Getopt allows you to populate a hash with results instead of individual variables:
See the documentation on CPAN.my %h = (); GetOptions (\%h, 'length=i'); # will store in $h{length}
The only downside I see here is that you can't initialize your options with defaults, although it is easy to do after the Getopt call (at the cost of typing the option names again, of course):
$h{'max_probs'} = 150 unless (exists $h{'max_probs'});
Hope this helps...
|
|---|