This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove a spurious undefined warning when using getopts.pl with -w.
[perl5.git] / lib / getopts.pl
index 4a50b8f..e30820a 100644 (file)
@@ -31,7 +31,7 @@ sub Getopts {
                                }
                                eval "
                                push(\@opt_$first, \$rest);
-                               if(\$opt_$first eq '') {
+                               if (!defined \$opt_$first or \$opt_$first eq '') {
                                        \$opt_$first = \$rest;
                                }
                                else {