in reply to Re^2: Processing arguments with Getopt::Long
in thread Processing arguments with Getopt::Long

the program will exit with an error if option t exists but not option c

It shouldn't, and it doesn't for me.

>perl a.pl -t a Option -t is value=a >perl a.pl -c a Option -c is value=a >perl a.pl -t a -c a Option -t is value=a Option -c is value=a >perl a.pl -c a -t a Option -c is value=a Option -t is value=a

If you're saying your program should exit, then yes, you have to add an check afterwards.

Replies are listed 'Best First'.
Re^4: Processing arguments with Getopt::Long
by MKJ747 (Acolyte) on Feb 18, 2011 at 17:02 UTC

    No, in my first example, the code is not setup to exit if c is not defined, because I wasn't sure how to do it. Sorry if I wasn't clear on that - just added the example as a change to the original example I posted. I see later post with examples to check, so I will check that out. Thanks for answering.