It means, that I feel sorry for you, because there's a Perl 4 smell ;-)
Seriously, here's the header of my /usr/lib/perl5/5.10.0/getopts.pl:

;# getopts.pl - a better getopt.pl # # This library is no longer being maintained, and is included for back +ward # compatibility with Perl 4 programs which may require it. # # In particular, this should not be used as an example of modern Perl # programming techniques. # # Suggested alternatives: Getopt::Long or Getopt::Std # ;# Usage: ;# do Getopts('a:bc'); # -a takes arg. -b & -c not. Sets opt_* a +s a ;# # side effect. sub Getopts { ...
It is probably a good idea to port the program to use Getopt::Std or Getopt::Long (... there's probably a require "getopts.pl"; somewhere in your program that needs to be replaced) .

Search for occurrences of $opt_* in your program and initialise them with a proper invocation of Getopt::Std::getopts() or Getopt::Long::GetOptions().

Update:   &Getopts('afg:s:n:vb:cd'); means:

flags:
-a, -f, -v, -c, -d
with argument:
-g xxx, -s xxx, -n xxx, -b xxx

Update2: Getopts::Long also allows you to use short flags, so you can keep the interface to your program backward compatible while beeing able to use long options at the same time (I guessed, what the switches might do!):

$result = GetOptions ( "all" => \$opt_a, "force" => \$opt_f, "verbose" => \$opt_v, "check" => \$opt_c, "debug" => \$opt_d, "get=s" => \$opt_g, "source=s" => \$opt_s, "number=i" => \$opt_n, "backup=s" => \$opt_b );


In reply to Re: getopts help by Perlbotics
in thread getopts help by limzz

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.