in reply to Re: GetOpt ignore required arguments
in thread GetOpt ignore required arguments

OK I should have clarified that some of my options have optional arguments, that is 0 or 1 or more. This presented a problem when you do something like this: cmd -option mandatory_arg When -option is allowed any number of arguments, including 0. However I think I fixed my problem using a variation of what linuxer told me, basically set the last argument in the ARGV array to "--" before GetOptions is called.

Replies are listed 'Best First'.
Re^3: GetOpt ignore required arguments
by Marshall (Canon) on Aug 24, 2011 at 11:00 UTC
    Yes, the idea that an option like "-a" sometimes has an arg and sometimes not, does present problems...
    [ -a [optional_arg ] ] Here -a is optional and its arg is optional (if there is a -a option).

    I personally would try to organize the UI so that each -option either has >= 1 args or no args. But I'm happy that you have a solution that works for your case! Thanks for reporting back on what worked for you!