GetOptions is destructive: it consumes @ARGV as it processes. You would need to test @ARGV before calling GetOptions.
I would suggest this instead, though: Just determine what the required arguments are, and test them. In your case, it seems like the required arguments are an alternation:
unless ( $alt1 or $alt2 or ( $alt3 and $alt4 )) { usage(); exit; }
In reply to Re^3: GetOptions and help
by fishbot_v2
in thread GetOptions and help
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |