in reply to Getopt::Declare parameter variables
#!/your/perl/here use strict; use warnings; use Getopt::Declare; unshift @ARGV, -one => 1, -two => 2 # <- defaults unless "@ARGV" =~ /(-help|-version)/; my $options = Getopt::Declare->new(<<'SPEC'); -one <one:i> first param: (default = 1) [repeatable] {$::one = $one; defer{ die "\t -one ($::one) > -two ($::two)\n" if $::one > $::two } } -two <two:i> second param: (default = 2) [repeatable] {$::two = $two} SPEC print "one = $options->{-one}\n"; print "two = $options->{-two}\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Getopt::Declare parameter variables
by QM (Parson) on Aug 25, 2004 at 17:44 UTC |