H
Hemant Shah
Folks,
Is there a easy way to find out if more than one option is specified.
Example:
use Getopt::Std;
getopts(abc);
if ($opt_a || $opt_b || $opt_c) {}
I only want user to specify one of the options (either -a or -b -or -c).
How do I easily check if they have specified more than one option.
I can write "if" statement as follows:
if (($opt_a && $opt_b && $opt_c) ||
($opt_a && $opt_b) ||
($opt_b && $opt_c) ||
($opt_a && $opt_c))
{
# print error message.
}
This could get ugly if the number of possible options is greater than 3.
Is there an easier way?
Thanks.
--
Hemant Shah /"\ ASCII ribbon campaign
E-mail: (e-mail address removed) \ / ---------------------
X against HTML mail
TO REPLY, REMOVE NoJunkMail / \ and postings
FROM MY E-MAIL ADDRESS.
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.
Is there a easy way to find out if more than one option is specified.
Example:
use Getopt::Std;
getopts(abc);
if ($opt_a || $opt_b || $opt_c) {}
I only want user to specify one of the options (either -a or -b -or -c).
How do I easily check if they have specified more than one option.
I can write "if" statement as follows:
if (($opt_a && $opt_b && $opt_c) ||
($opt_a && $opt_b) ||
($opt_b && $opt_c) ||
($opt_a && $opt_c))
{
# print error message.
}
This could get ugly if the number of possible options is greater than 3.
Is there an easier way?
Thanks.
--
Hemant Shah /"\ ASCII ribbon campaign
E-mail: (e-mail address removed) \ / ---------------------
X against HTML mail
TO REPLY, REMOVE NoJunkMail / \ and postings
FROM MY E-MAIL ADDRESS.
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.