in reply to parsing commandline arguments

Well, you can certainly do it this way if you want, however you'll find it much nicer to use Getopt::Long.