#!/usr/bin/env perl use strict; use warnings; use Getopt::Long; use Pod::Usage; use Data::Dump; my ( %options, $option ); Getopt::Long::Configure("no_ignore_case"); GetOptions( \%options, "help", "abc=s", "def=s" ); pod2usage( -exitstatus => 0, -verbose => 2 ) if $options{help}; # added foreach $option ( $options{abc}, $options{def} ) { pod2usage( -exitstatus => 2, -verbose => 2 ) unless $option; } dd %options; # your code here... __END__ =pod =head1 NAME options.pl =head1 SYNOPSIS ./options.pl [options] =head1 OPTIONS =over 8 =item B<-h, --help> Prints a brief help message and exits. =item B<-a, --abc> Bla, bla. =item B<-d, --def> Bla, bla. =back =head1 DESCRIPTION It's just an example. =head1 USAGE ./options.pl -a foo -d bar =head1 BUGS None. =head1 AUTHOR Karl Goethebier =cut