#!/usr/bin/perl use Getopt::Declare; my $args = new Getopt::Declare <<'EOPARAM'; [strict] -e Collect data for systems in one env (can be used with -t) -t Collect data for one type of system (can be used with -e) -s Collect data for one system [excludes: -e -t] -- EOPARAM for ( qw(-e -s -t) ) { print "Using value: ", $args->{$_}." for switch $_\n" if $args->{$_}; } __END__ perl 559575.pl -s quux -e foo -t bar #### Error: parameter '-e' not allowed with parameter '-s' Error: parameter '-t' not allowed with parameter '-s' Error: unrecognizable argument ('foo') Error: unrecognizable argument ('bar') (try '559575.pl -help' for more information)