Expanding on what tye
said, you are wandering in very
dangerous territory with your construct. First of all
your construct is wandering into the my $foo if 0
. Secondly if your user mistypes the
command line ever so slightly then neither you nor they
get a chance to catch that fact. Thirdly you do not have
any chance to choose to have certain options take arguments.
I generally rectify all of these with Getopt::Std. If you
want longer option names, you can use Getopt::Long
instead. (It has a significantly more complex interface
though.) Both are part of the standard distribution..