in reply to validating the command line input

For that type of problem, I'd used Damian Conway's Getopt::Euclid.