in reply to Usage of flags in scripts

The problem comes down to processing command line options. Check out GetOpt::Long module from CPAN. Please consult http://perldoc.perl.org/Getopt/Long.html.