summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/lib/getopts.pl
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-11-30 08:00:32 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-11-30 08:00:32 +0000
commit3d06de7fcff1d605886d3c63220956f7260ddb84 (patch)
treeda5aa4b971926e3ef1f9263bbdeb714053206d02 /gnu/usr.bin/perl/lib/getopts.pl
parentc54c74271308a8fd18f1bc3a193343d079ebe481 (diff)
perl 5.004_04
Diffstat (limited to 'gnu/usr.bin/perl/lib/getopts.pl')
-rw-r--r--gnu/usr.bin/perl/lib/getopts.pl9
1 files changed, 4 insertions, 5 deletions
diff --git a/gnu/usr.bin/perl/lib/getopts.pl b/gnu/usr.bin/perl/lib/getopts.pl
index a0818d1e3a0..852aae89b18 100644
--- a/gnu/usr.bin/perl/lib/getopts.pl
+++ b/gnu/usr.bin/perl/lib/getopts.pl
@@ -8,23 +8,22 @@ sub Getopts {
local($argumentative) = @_;
local(@args,$_,$first,$rest);
local($errs) = 0;
- local($[) = 0;
@args = split( / */, $argumentative );
while(@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
($first,$rest) = ($1,$2);
$pos = index($argumentative,$first);
- if($pos >= $[) {
- if($args[$pos+1] eq ':') {
+ if($pos >= 0) {
+ if($pos < $#args && $args[$pos+1] eq ':') {
shift(@ARGV);
if($rest eq '') {
++$errs unless @ARGV;
$rest = shift(@ARGV);
}
- eval "\$opt_$first = \$rest;";
+ ${"opt_$first"} = $rest;
}
else {
- eval "\$opt_$first = 1";
+ ${"opt_$first"} = 1;
if($rest eq '') {
shift(@ARGV);
}