use Getopt::Long qw( GetOptions ); Getopt::Long::Configure(qw( posix_default )); GetOptions( 'help|h|?' => \&help, 'verbose|v' => \my $verbose, 'force|f' => \my $force, 'table|t=s' => \my $table, ) or usage(); @ARGV == 0 or usage( "Too many arguments" );