Help for this page

Select Code to Download


  1. or download this
            use Getopt::Hash;
            my %opt = GetOptions(
    ...
            if ($opt{'option_name'} eq 'some_value') {
                    ## do work ##
            }
    
  2. or download this
            use Getopt::Long;
            my %opt = (
    ...
            if ($opt{'option_name'} eq 'some_value') {
                    ## do work ##
            }
    
  3. or download this
            'getopt_spec_string' => 'default_value'
    
  4. or download this
            my %opt = GetOptions(
                    'option_name|on:s' => 'default_value',
                    'element|e!'       => 0,
                    'count|cnt|c=i'    => 5,
            );
    
  5. or download this
            'option_name' => 'default_value',
            'element'     => 0,
            'count'       => 5,
    
  6. or download this
    package Getopt::Hash;
    use strict; use warnings;
    ...
    
    =cut