title: Incorrect behavior of perl module `Getopt::Long::Subcommand` in perl version 5.24.1
body: <p>I'm using <code>Getopt::Long::Subcommand</code> to parse the command line arguments. </p>
  
  <p>But I found that in some of Perl versions. This module has incorrect behavior. </p>
  
  <p>For example if I run <code>./ViewBS BisNonConvRate --sample bis_WT.tab.gz,WT</code>. I expect the output as below:</p>
  
  <pre><code>Subcommand: BisNonConvRate
  Sample list: bis_WT.tab.gz,WT
  </code></pre>
  
  <p>In perl-v5.18.2, it works fine. I got the output I expected. 
  But in perl-v5.24.1, it does NOT. I got the output shown as below:</p>
  
  <pre><code>Subcommand: BisNonConvRate
  Sample list:
  </code></pre>
  
  <p>I checked version of <code>Getopt::Long::Subcommand</code>. Both of them are the same version (0.102).</p>
  
  <p>Could anyone help on this issue? Thanks in advance. </p>
  
  <p>Here is how I configure the perl environment: </p>
  
  <pre><code>perlbrew install perl==5.24.1 ## or perl==5.18.2
  perlbrew use perl-5.24.1
  perlbrew install-cpanm
  cpanm Getopt::Long::Subcommand
  cpanm Bio::DB::HTS::Tabix
  cpanm Bio::SeqIO
  
  </code></pre>
  
  <p>Here is my code using <code>Getopt::Long::Subcommand</code> in 'ViewBS':</p>
  
  <pre><code>#!/usr/bin/env perl 
  #!/usr/bin/perl --
  
  ####################################################################
  # ViewBS - Tools for exploring and visualizing bisulfite sequencing 
  # (BS-seq) data. 
  ####################################################################
  use strict;
  use warnings;
  
  use Getopt::Long::Subcommand;
  use Pod::Usage;
  use File::Basename;
  use Cwd qw(abs_path);
  use Benchmark;
  my $t_stt = Benchmark-&gt;new;
  
  #use FindBin;
  #use lib "$FindBin::Bin";
  $|++;    # Do not buffer output
  #$| = 1; # Do not buffer output 
  
  #Self written libraries.
  ## Package written by Shanshan Huang
  use lib dirname(abs_path $0) . '/lib';  #include seft written packages in @INC.
  
  my $main_path = dirname(abs_path $0);
  
  my %opts;   ## store the values for common parameters
  my %opts_subcmd; ### store the values for sub command parameters
  
  ### Return hash structure, with these keys: success, subcommand (array of str) by GetOptions
  my $resOpt = &amp;processCMD();  
  
  my ($sub_cmd) = @{$resOpt-&gt;{subcommand}}; 
  print "\nSubcommand: $sub_cmd\n";
  
  if($sub_cmd eq "BisNonConvRate"){
      print "Sample list: @{$opts_subcmd{sample}}\n";
  }
  
  sub processCMD{
      $resOpt = GetOptions(   # Return hash structure, with these keys: success, subcommand (array of str)
          ## common options recognized by all subcommands
          options =&gt; {
          'help|h|?'       =&gt; \$opts{help},
          'version|v'      =&gt; \$opts{version},
          'verbose'        =&gt; \$opts{verbose},
          'outdir:s'       =&gt; \$opts_subcmd{outdir},
          'prefix:s'       =&gt; \$opts_subcmd{prefix},
          'minDepth:s'     =&gt; \$opts_subcmd{minDepth},
          'maxDepth:s'     =&gt; \$opts_subcmd{maxDepth},
          'context:s'      =&gt; \@{$opts_subcmd{context}},    # context
          'flank:i'        =&gt; \$opts_subcmd{flank},
          'height:f'       =&gt; \$opts_subcmd{height},  ## figure size: height
          'width:f'        =&gt; \$opts_subcmd{width},   ## figure size: width
          'height2:f'       =&gt; \$opts_subcmd{height2}, ## for histogram
          'width2:f'        =&gt; \$opts_subcmd{width2},  ## for histogram
          'random_region:i' =&gt; \$opts_subcmd{random_region}, ## For heatmap error. annot allocate vector of size
          'methodAverage'  =&gt; \$opts_subcmd{methodAverage},  ## Calculate the average methylation level rather than the weighted methylated level.
           },
           subcommands =&gt; {
               MethGeno =&gt; {       
                   summary =&gt; 'Plot methylation information across the chromsome.',
                   # subcommand-specific options
                   options =&gt; {
              # mandatory arguments
                  'genomeLength|g:s'       =&gt; \$opts_subcmd{genomeLength},
              'sample:s'               =&gt; \@{$opts_subcmd{sample}},
              # Optional arguments
              'win:i'                  =&gt; \$opts_subcmd{win},
                      'step:i'                 =&gt; \$opts_subcmd{step},       
              'minLength:s'            =&gt; \$opts_subcmd{minLength},  # cutoff for minimum length of chromosome.
              'split:s'                =&gt; \$opts_subcmd{'split'},      #
                   }
              },
          MethOverRegion =&gt; {
          summary =&gt; 'Plot average distribution of methylation over your defined regions.',
          options =&gt; {
              # mandatory arguments
              'region:s'              =&gt; \$opts_subcmd{region},
                      'sample:s'               =&gt; \@{$opts_subcmd{sample}},
              # Optional arguments
              'binLength:i'        =&gt; \$opts_subcmd{binLength},
              'binNumber:i'            =&gt; \$opts_subcmd{binNumber},
                  'minLength:i'        =&gt; \$opts_subcmd{minLength},
              'maxLength:i'            =&gt; \$opts_subcmd{maxLength},
                      'type:s'                 =&gt; \$opts_subcmd{type},
                  'regionName:s'           =&gt; \$opts_subcmd{regionName},
                  #'legendTitle:s'          =&gt; \$opts_subcmd{legendTitle},
          }
          },
          MethHeatmap =&gt; {
                  summary =&gt; 'Generate heatmap for a given regions.',
                  options =&gt; {
                      # mandatory arguments
                      'regions:s'              =&gt; \$opts_subcmd{region},
                      'sample:s'               =&gt; \@{$opts_subcmd{sample}},
               # Optional arguments
                      'merge'                 =&gt; \$opts_subcmd{merge},   ### if --merge is true, then methylation level of different will be generated in one file rather than one file for each context
                      'cluster_cols:s'         =&gt; \$opts_subcmd{cluster_cols},
              'cluster_rows:s'         =&gt; \$opts_subcmd{cluster_rows},
                  }
              },
          MethOneRegion =&gt; {
                  summary =&gt; 'Generate heatmap for a given regions.',
                  options =&gt; {
              'regions:s'              =&gt; \$opts_subcmd{region},
                  'sample:s'               =&gt; \@{$opts_subcmd{sample}},
               }
          },
              MethCoverage =&gt; {
                  summary =&gt; 'Generate statistics of read coverage of the provided samples.',
                  options =&gt; {
          'reference:s'        =&gt; \$opts_subcmd{reference},
                  'sample:s'               =&gt; \@{$opts_subcmd{sample}},
          'outdir:s'               =&gt; \$opts_subcmd{outdir},
                   }
              },
          MethLevDist =&gt; {
                  summary =&gt; 'Generate distribution of methylation levels for the provided samples.',
                  options =&gt; {
                  'sample:s'               =&gt; \@{$opts_subcmd{sample}},
          'regions:s'              =&gt; \$opts_subcmd{region},
          'binMethLev:s'       =&gt; \$opts_subcmd{binMethLev},
                   }
              },
          GlobalMethLev =&gt; {
                  summary =&gt; 'Generate global (bulk) methylation levels for the provided samples.',
                  options =&gt; {
                  'sample:s'               =&gt; \@{$opts_subcmd{sample}},
                   }
              },
          BisNonConvRate =&gt; {
                  summary =&gt; 'Estimate non-conversion rate of BS-seq data.',
                  options =&gt; {
                  'sample:s'               =&gt; \@{$opts_subcmd{sample}},
              'chrom:s'               =&gt; \$opts_subcmd{chrom},
                   }
              },
          }
      );
      #print "UUXXX", join("\t", $resOpt-&gt;{subcommand}), "\n";
      push @{$opts_subcmd{subcommand}}, @{$resOpt-&gt;{subcommand}} if exists $resOpt-&gt;{subcommand};
      return $resOpt;
  }
  
  </code></pre>
  
  <p>You can also get a copy of the file here: <a href="https://github.com/xie186/ViewBS/tree/66edfa79c35b404539ca3cdf4afcfd9c1bd20c6d/data/chk_issue25" rel="nofollow noreferrer">https://github.com/xie186/ViewBS/tree/66edfa79c35b404539ca3cdf4afcfd9c1bd20c6d/data/chk_issue25</a></p>