in reply to Re: Examples for using Getopt::Long
in thread Examples for using Getopt::Long

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: Examples for using Getopt::Long
by gellyfish (Monsignor) on May 10, 2005 at 09:46 UTC

    Of course this all completely and thoroughly described in the Getopt::Long documentation and I really think you should spend a bit more time reading it yourself than asking questions here, however it is quite simply really: GetOptions gets passed a hash describing the options for the program that are to be passed: the key is the option itself with an optional type and the value is a reference to a variable which will receive the value of the option. So in the case of the  'u=s' => \$user you have an option -u which is a string and who's value will be placed in the variable $user. The options are parsed and placed in the appropriate variables when GetOptions is called - this is why the module only requires the single function.

    /J\