in reply to Re: Getopt::Std and simple options
in thread Getopt::Std and simple options

Yes, very astute, I am trying to set a verbose flag. :)

Thanks for your helpful reply. I should have used getopts() as getopt only takes opts with a value. I will take on board the other comments.

~Diz

Replies are listed 'Best First'.
Re^3: Getopt::Std and simple options
by graff (Chancellor) on Sep 07, 2005 at 02:17 UTC
    Checking the return value from each of the Getopt::* variants is what makes these functions really useful. An idiom that I use almost constantly for command-line tool scripts goes like this:
    my $Usage = "Usage: $0 -a [-b arg] whatever ...\n"; getopts( ... ) or die $Usage;
    When I need a reminder about the command line syntax for one of my scripts (this happens a lot), I just run it with "-?" as the only arg; since I never use "?" as an option flag, I always get the usage message.