On Wed, 27 Mar 2002, Agustin Rivera wrote:
> Ok, I've tried it both ways and it returns 1 (true) as the value. What am I
> doing wrong?
Agustin:
1. What *exactly* do you mean "both" ways?
2. References...
>From the Getopt::Std man page:
getopt('oDI'); # -o, -D & -I take arg. Sets opt_*...
getopts('oif:'); # -o & -i are boolean flags, -f takes an argument
# Sets opt_*...
Pass one argument which is a
string containing all switches that take an argument. For
each switch found, sets $opt_x (where x is the switch
name) to the value of the argument, or 1 if no argument.
>From "The Ram Book":
Getop::Std also provides the getopts function which lets you specify
whether each option is Boolean or takes a value. Arguments that take a
value... are indicated by a ':'
In summary:
getopts() will set BOOLEAN values OR the value supplied *if* the option
is followed by a ':' in the function call getopts("x:").
getopt() will set the command-line value.
--
Eric P.
Los Gatos, CA
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]