#!/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 first param: (default = 1) [repeatable] {$::one = $one; defer{ die "\t -one ($::one) > -two ($::two)\n" if $::one > $::two } } -two second param: (default = 2) [repeatable] {$::two = $two} SPEC print "one = $options->{-one}\n"; print "two = $options->{-two}\n";