Using getopts and have 4 options; H, M, X , C
getopts('HX:M:C');
use vars qw($opt_H, $opt_X, $opt_M, $opt_C);
if ($opt_H) {...};
if ($opt_C) {...};
if ($opt_M) {...};
if ($opt_X) {...};
1. H is for help
2. C, M or X can be used by themselves
3. C and M can be used together and C must be used first
4. C cannot be used with X
How can I enforce the requirements for 3 & 4?
getopts('HX:M:C');
use vars qw($opt_H, $opt_X, $opt_M, $opt_C);
if ($opt_H) {...};
if ($opt_C) {...};
if ($opt_M) {...};
if ($opt_X) {...};
1. H is for help
2. C, M or X can be used by themselves
3. C and M can be used together and C must be used first
4. C cannot be used with X
How can I enforce the requirements for 3 & 4?