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:
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) .;# 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 { ...
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:
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |