amt has asked for the wisdom of the Perl Monks concerning the following question:
my ($db,$killswitch,$configDepth,$hostname) #default values = (0 ,0 ,-1 ,''); GetOptions( 'v!' => \$db , 'k!' => \$killswitch , 'd=i'=> \$configDepth , 'H=s'=> \$hostname ); if( $configDepth == -1){ print $0.' requires the -d switch with a dept +h value.'.$cr; die; } if( $hostname == '' ){ print $0.' requires the -H with a hostname or + comma-seperated list of hostnames.'.$cr; die;}
$>traverse.pl -v -H WSTM0165815 -d=1 C:\depot\code\util\pl\traverse.pl requires the -H with a hostname or c +omma-seperated list of hostnames. Died at C:\depot\code\util\pl\traverse.pl line 34.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getopt::Long Help with Mandatory String Opt
by ikegami (Patriarch) on Aug 10, 2010 at 19:59 UTC | |
by amt (Monk) on Aug 10, 2010 at 20:02 UTC |