![]() |
|
Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Using Getopt::Long and prompting for argumentsby why_bird (Pilgrim) |
on May 01, 2008 at 08:25 UTC ( #683881=note: print w/replies, xml ) | Need Help?? |
From the CPAN description of GetOpt::Long, for variables which can take a value:
"In the option specification, the option name is followed by an equals sign = and the letter s. The equals sign indicates that this option requires a value. The letter s indicates that this value is an arbitrary string. Other possible value types are i for integer values, and f for floating point values. Using a colon : instead of the equals sign indicates that the option value is optional. In this case, if no suitable value is supplied, string valued options get an empty string '' assigned, while numeric options are set to 0." So if you set the value to be optional, and if a user does not enter a filename, the value of $user_wants{CUSTOM_SAVE_PLACE} will be ''.
edit:added 'if defined' Those are my principles. If you don't like them I have others. -- Groucho Marx .......
In Section
Seekers of Perl Wisdom
|
|