in reply to Re: Making Getopt::Long tell me if no parameters passed
in thread Making Getopt::Long tell me if no parameters passed

Thanks.

I decided to go with
&usage if not defined $user; &usage if not defined $pass; &usage if not defined $config;
until I could figure out something more elegant.

Cheers,
ibanix

$ echo '$0 & $0 &' > foo; chmod a+x foo; foo;

Replies are listed 'Best First'.
Re^3: Making Getopt::Long tell me if no parameters passed
by Aristotle (Chancellor) on Dec 17, 2002 at 11:58 UTC
    fever pointed out the right thing to do, but just for completeness' sake, your approach could be condensed, too. The obvious, naive version: &usage unless (defined $user) or (defined $pass) or (defined $config); And the Once And Only Once version: &usage unless grep defined, $user, $pass, $config; That said, go with passing GetOptions a hashref.

    Makeshifts last the longest.