Shouldn't $RCfile, $fixtarget, and $midlopts be passed to GetOptions() as references?

If you want to allow unspecified options to not cause warnings/errors, use the 'pass_through' option on Getopt::Long::Configure(), but that will leave the unspecified options in @ARGV, so if you want to remove them from @ARGV, you could also use Getopt::Std like so:

# Configure here or with Getopt::Long::Configure() use Getopt::Long qw(:config pass_through); use Getopt::Std; my ($verbose, @linkfiles, $RCfile, $fixtarget, $midlopts); GetOptions ( 'help|?|h' => \&show_options, 'verbose!' => \$verbose, 'v' => \$verbose, 'L=s' => \@linkfiles, 'RC=s' => $RCfile, 'fixtarget!' => $fixtarget, 'midlopts=s' => $midlopts ) or die; # If you don't want '$opt_*' variables # springing into existence, supply a hashref to getopt. # Of course there's an ambiguity about whether # or not your 'bad' options are supposed to take an # argument, so there isn't really any perfect solution here. my %other_opts; getopt('', \%other_opts); print "ARGV: @ARGV\n";

In reply to Re: Error inside Getopt::Long by runrig
in thread Error inside Getopt::Long by John M. Dlugosz

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.