in reply to Need help using Getopt, please.
You don't need to enumerate abbreviations. Getopt::Long allows the user to specify options using the smallest unique abbreviation. For example... if you have an option called 'help', the user can specify '--h' on the commandline and it will automatically work. If you have an option 'help' and 'hop', the smallest unique abbreviations would be '--he' and '--ho'.
This also works for '--no*' options. For example, if you have a switch called 'try', and you set up the capability for it to be negated with 'notry', you can also use the abbreviations '--t' and '--not'.
Again, this is all automatic by default in Getopt::Long. It can be disabled, tweaked, etc., but by default, you get this behavior. So the ramification is that it's unnecessary to specify 'help|h' as an option, because if your option is specified as 'help', the user can enter 'help', 'hel', 'he', and 'h', as long as each of those abberviations is unique.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Need help using Getopt, please.
by Seventh (Beadle) on Jan 21, 2005 at 16:46 UTC |