#!/usr/bin/perl -w use strict; use Getopt::Std; my %Opt; Get_Args(); sub Get_Args { my $Usage = qq{Usage: $0 [options] -h : This help message. -a : BOGUS - requires argument if used -A : BOGUS -b : BOGUS } . "\n"; getopts( 'ha:Ab' , \%Opt ) or die $Usage; die $Usage if $Opt{h}; die "You did not enter any options\n" if ! %Opt; if ( exists $opt{a} || exists $opt{A} ) { if ( ! ( exists $opt{a} && exists $opt{A} ) ) { die "You must use -a and -A together\n"; } } }