cat p.pl perl p.pl -h -p 1 ; \ perl p.pl -p q -h ; \ perl p.pl -p -h ; \ perl p.pl -p q ; \ perl p.pl -p ; \ perl p.pl -p 3 use strict; use warnings; # May or may not work wit previous version(s). use Getopt::Long 2.38; my ( $h ); Getopt::Long::Configure( 'pass_through' ); GetOptions( 'help' => \$h ); die "HELP" if $h; my ( $p ); Getopt::Long::Configure( 'nopass_through' ); Getopt::Long::GetOptionsFromArray ( \@ARGV , 'p=i' => \$p ) or die; printf "p: %s\n" , defined $p ? $p : 'undef'; __END__ HELP at p.pl line 10. HELP at p.pl line 10. HELP at p.pl line 10. Value "q" invalid for option p (number expected) Died at p.pl line 14. Option p requires an argument Died at p.pl line 14. p: 3