For that type of problem, I'd used Damian Conway's Getopt::Euclid.
In reply to Re: validating the command line input by clueless newbie in thread validating the command line input by Rash_10oct