1 ;# getopts.pl - a better getopt.pl
4 ;# do Getopts('a:bc'); # -a takes arg. -b & -c not. Sets opt_* as a
8 local($argumentative) = @_;
9 local(@args,$_,$first,$rest,$errs);
12 @args = split( / */, $argumentative );
13 while(($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
14 ($first,$rest) = ($1,$2);
15 $pos = index($argumentative,$first);
17 if($args[$pos+1] eq ':') {
22 eval "\$opt_$first = \$rest;";
25 eval "\$opt_$first = 1";
35 print STDERR "Unknown option: $first\n";