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);
12 @args = split( / */, $argumentative );
13 while(@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
14 ($first,$rest) = ($1,$2);
15 $pos = index($argumentative,$first);
17 if($pos < $#args && $args[$pos+1] eq ':') {
23 ${"opt_$first"} = $rest;
36 print STDERR "Unknown option: $first\n";