bahadur has asked for the wisdom of the Perl Monks concerning the following question:
now this code handles the switches u, p and s. but suppose i am supposed to give a command line swtich like h which does nothing but to invoke a help message. how do that with it.Getopt::Long::GetOptions ( 'u=s' => \$user, 'p=s' => \$passwd, 's=s' => sub { local *_ = \$_[1]; /^([^:]+):(\d+)$/ or die("Invalid format for option s.\n"); $host = $1; $port = $2;}, ) or error_detect("3 Invalid commmand line options.");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: handling switches with no argument using GetOpt::Long
by Joost (Canon) on May 19, 2005 at 11:28 UTC | |
|
Re: handling switches with no argument using GetOpt::Long
by holli (Abbot) on May 19, 2005 at 11:27 UTC |