Hi -
I've been thru the GetOpt::Long wars, so here's
my two bits:
The CPAN documentation states:
When no destination is specified for an option,
GetOptions will store the resultant value in a global
variable named opt_XXX, where XXX ...
under use strict (recommended), these variables must
be pre-declared with our() or use vars.
our $opt_length = 0;
GetOptions ('length=i'); # will store in $opt_length
your variables are 'my's:
>my $opt_w;
>my $opt_cmdfile;
>...
>if(! GetOptions("-",
> "w=s",
> "cmdfile=s",
> "help|h"
> )){
Why use default names? I normally say something like:
GetOptions (("length=i" => \$length, ...);
then I can use my and know exactly what's going on.
Just try the single -:
test.pl -h
Off your subject, no need to say:
>if(defined($opt_help) && $opt_help){...
just say:
if($opt_help){...
you have already defined it with your my
(let's save keystrokes!)
Aloha => Beau.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]