Perl : How to handle command line options in perl programs

ambuli
ambuli used Ask the Experts™
on
Hi Experts,

I have to handle few command line options.

myProg mandatory1, mandatory2 [-a] [-b] [-c]
i.e the program takes two mandatory arguments( which I have done it using argv) and many other optional values.  How can I do this?  Any example please.

Thank you.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Take a look at some of the Getopt modules on CPAN (any module named Getopt::* on http://search.cpan.org/modlist/Option_Parameter_Config_Processing).  Getopt::Long and Getopt::Std are installed as part of perl - I think the others are all installed separately.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial