<?xml version="1.0" encoding="windows-1252"?>
<node id="985223" title="Re: How to find what options are used for Getopt::Long" created="2012-08-03 08:17:55" updated="2012-08-03 08:17:55">
<type id="11">
note</type>
<author id="622051">
toolic</author>
<data>
<field name="doctext">
Another way is to store all your opt in a hash instead of individual scalars:


&lt;c&gt;
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' =&gt; 1,
          'verbose' =&gt; 1
        };

&lt;/c&gt;

&lt;p&gt;


&lt;ul&gt;
&lt;li&gt;[doc://Getopt::Long]

&lt;/ul&gt;
</field>
<field name="root_node">
985194</field>
<field name="parent_node">
985194</field>
</data>
</node>
