in reply to Required options processing Getopt::Long
Why not use the hashref option of GetOptions?
my %options; my @required = qw(table id_field); GetOptions ( \%options, 'table=s', 'id_field=s', 'state_field=s', 'zip_field=s', 'dob_field=s', 'help|?', 'man' ) or die pod2usage(2); # dies if an unlisted option is given # if an option isn't specified, it isn't set in the hash so # we look for the ones we want and make certain they're there die pod2usage(2) if grep(!exists $options{$_},@required);
Hope this helps.
antirice
The first rule of Perl club is - use Perl
The ith rule of Perl club is - follow rule i - 1 for i > 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Required options processing Getopt::Long
by Aristotle (Chancellor) on Aug 16, 2003 at 18:11 UTC |