GetOptions ("user=s" => \$user, "server=s" => \@servers, "command=s" = +> \@commands, "file=s" =>\$file, "dest=s"=> \$dest, "config=s" => \$c +onfig, "help=s" => \$help);
Putting the "=s" on the "config" option says that using --config is only allowed if you provide it with a value (ie: --config=file.txt)
Since you are calling your script without providing any value to the --config option, the call to GetOptions is failing and not updating any of your variables.
Try running this script...#!/usr/local/bin/perl -wl use Getopt::Long; my $config = "default"; my $result = GetOptions("config=s" => \$config); print "result = $result"; print "config = $config"; __END__ > monk.pl result = 1 config = default > monk.pl --config Option config requires an argument result = config = default > monk.pl --config=foo result = 1 config = foo
In reply to Re: Re: Re: Re: Re: Problem with GetOpts::Long
by hossman
in thread Problem with GetOpts::Long
by niku
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |