http://www.perlmonks.org?node_id=985223


in reply to How to find what options are used for Getopt::Long

Another way is to store all your opt in a hash instead of individual scalars:
use warnings; use strict; use Getopt::Long; use Data::Dumper; $Data::Dumper::Sortkeys=1; my %opt; GetOptions(\%opt, qw( help cfg=s verbose silent dir=s )) or die "Mandatory options not supplied\n"; print Dumper(\%opt); __END__ script.pl -h -v $VAR1 = { 'help' => 1, 'verbose' => 1 };

Replies are listed 'Best First'.
Re^2: How to find what options are used for Getopt::Long
by doubledecker (Scribe) on Aug 07, 2012 at 11:02 UTC

    Works for me