in reply to parsing commandline arguments
If you know that its been done, and is being done often, check for a module. As fever said, Getopts applies here, but you never want to waste time writting code that has already been written.