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

Use Getopt::Std to parse the options for you then check that you got everything:

use strict; use warnings; use Getopt::Std; my %opts; getopts('b:l:', \%opts); if (! exists $opts{b} || ! exists $opts{l}) { die "Both -b and -l options are required\n"; } print "-b: $opts{b}, -l $opts{l}\n";
True laziness is hard work
  • Comment on Re: How to make sure to print usage when the options are not entered?
  • Download Code

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.