I wrote a nice little Ruby script a while back that I\'m rather fond of. I\'d like to improve its robustness by checking for the proper number of arguments:
This isn't quite an answer to your question, but it sounds like you're reinventing a wheel. Look at the optparse library. It lets you define command line switches, arguments, etc, and it'll do all the heavy lifting for you.