in reply to parsing commandline arguments
You may wish to consider reading my Tutorial on the subject, which has nearly the same title :)
Parsing your script's command line