in reply to getopts and -?
getopts('oif:', \%opts); # options as above. Values in %opts
no strict 'refs'; warn local ${"opt_?"} = 6;
use Getopt::Long; GetOptions( q!help|h|?! => \$help );
$ perl -MGetopt::Long -e " my $help; GetOptions( q!help|h|?! => \$help + ); warn $help; " -- --help 1 at -e line 1. $ perl -MGetopt::Long -e " my $help; GetOptions( q!help|h|?! => \$help + ); warn $help; " -- -h 1 at -e line 1. $ perl -MGetopt::Long -e " my $help; GetOptions( q!help|h|?! => \$help + ); warn $help; " -- -? 1 at -e line 1. $ perl -MGetopt::Long -e " my $help; GetOptions( q!help|h|?! => \$help + ); warn $help; " -- -f Unknown option: f Warning: something's wrong at -e line 1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: getopts and -?
by viffer (Beadle) on May 10, 2011 at 02:35 UTC | |
by Anonymous Monk on May 10, 2011 at 02:52 UTC | |
by viffer (Beadle) on May 10, 2011 at 02:57 UTC | |
by viffer (Beadle) on May 10, 2011 at 02:43 UTC | |
by viffer (Beadle) on May 10, 2011 at 02:49 UTC | |
by viffer (Beadle) on May 10, 2011 at 02:54 UTC |