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);
11 @args = split( / */, $argumentative );
12 while(($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
13 ($first,$rest) = ($1,$2);
14 $pos = index($argumentative,$first);
16 if($args[$pos+1] eq ':') {
21 eval "\$opt_$first = \$rest;";
24 eval "\$opt_$first = 1";
34 print stderr "Unknown option: $first\n";