As has been suggested, Getopt::Long is the module you want. You can find dozens of examples online on how to use this option. Google it, if you can't do the CPAI^HN thing. Create a seperate usage subroutine and redirect all bad options to that, and once you make your initial call to getopt, if you find that the argument array still has things in it, you can flag an error on that too.
Rather than trying to solve your whole problem, I suggest you write a little test program just for getopt, and play with that. It comes in handy if you need to write any additional scripts, as getopt is generally the first thing EVERY perl script does. That's generally good advice is to test out a new feature in a tiny program before you apply it to whatever big program you're attempting to use.
Good luck, --Ray
In reply to Re: command line switches (array)
by raybies
in thread command line switches (array)
by blackice69
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |