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.