in reply to How to make sure to print usage when the options are not entered?

You have 3 arguments, so $#ARGV is 2, your if is false and nothing gets printed

But that's beside the point, you really should use either Getopt::Std or Getopt::Long, two modules that take care of command line arguments for you. Maybe you haven't used a module yet, this is the perfect time to use your first one. It's easy and both modules are already included in any normal perl distribution, so you should have them ready for use

Getopt::Std is the simpler module, but you have to check for yourself that at least one of the options was specified, Getopt::Long is more complex, but there you can specify whether options are optional or required.

  • Comment on Re: How to make sure to print usage when the options are not entered?