Not really, it's simply taking dd as the value of the -d option.
True. The code is pretty convoluted and is also very old. But the key logic can easily be improved adding less then a dosen of lines. Legacy code like built in help screen via option -help that nobody needs can be removed. The value of @EXPORT array is unclear and probably can be removed too (archaeological Perl). All useful functionality can be implemented in 40 lines or less. Here is my variant, which probably can be considerably improved as this idea of extracting $first and $rest via regex is open to review: they split at the fixed position.
#!/usr/bin/perl
use v5.10;
   use warnings;
   use strict 'subs';
   use feature 'state';
   use Getopt::Std;

   getopts('b:cd:',\%options);
   foreach $opt (keys(%options)) {
      if($options{$opt} eq '' ){
         say "$opt is set to ''";
      }else{
         say "$opt is set to $options{$opt}";
      }         
   }
   exit 0;
sub getopts
{
my ($argumentative,$hash)=@_;
my (@args,$first,$rest,$pos);
   @args = split( //, $argumentative );
   while(@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)$/s ){
      ($first,$rest) = ($1,$2);
      if (/^--$/) {	# early exit if --
         shift @ARGV;
         last;
      }
      $pos = index($argumentative,$first);
      if( $pos==-1) {
         warn("Undefined option -$first skipped without processing\n");
         shift(@ARGV);
         next;
      }
      if (defined($args$pos+1) and ($args$pos+1 eq ':')) {
         # option with parameters
         if( $rest eq ''){          
            unless( @ARGV ){
               warn("End of line reached for option -$first which requires argument\n");
               $$hash{$first}='';
               last;
           }
           if ( $ARGV[0] =~/^-/ ) {
               warn("Option -$first requires argument\n");
               $$hash{$first} = '';
           }else{
               $$hash{$first}=$ARGV[0];
               shift(@ARGV); # get next chunk
           }
         } else {
            if( ($first x length($rest)) eq $rest ){
               $$hash{$first} = length($rest)+1;
            }else{
               $$hash{$first}=$rest;
            }
            shift(@ARGV);
         }
      }else {
         $$hash{$first} = 1; # set the option
         if ($rest eq '') {
            shift(@ARGV);
         } else {
            $ARGV[0] = "-$rest"; # there can be other options without arguments after the first
         }
      }
   }
}

Here are two test runs:

[0]  # perl  Std2.pl  -c -b -ddd
Option -b requires argument
d is set to 3
c is set to 1
b is set to ''
 
[0]  # perl   Std2.pl  -c -ddd -b
End of line reached for option -b which requires argument
d is set to 3
c is set to 1
b is set to ''

In reply to Re^2: Inconsistent behavior of Getopt::Std by likbez
in thread Inconsistent behavior of Getopt::Std by likbez

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.