On Wed, May 16, 2012 at 10:56:59AM +0000, Michael Brader wrote: > Hi, Hello:
> Your problem is that Getopt::Long is consuming your -help as > the argument to -abc before it can be recognised. You might be > able to do something with the other Getopt::* modules, but the > following piece of code will do what you want if you really > need it: > > use List::MoreUtils qw(any); > use Getopt::Long; > > my $abc; > my $help; > > if ( any { $_ eq '-help' } @ARGV ) { > $help = 1; Note that this doesn't account for '--help'. :) Besides, what if '--help' happens to be a valid option argument? This would prevent that from working. I think it's best to just keep with the module's behavior and work normally. If a user wants --help then they should generally /just/ say --help. If you want to do some kind of option-specific help then specify --help before --the-option: my-command --help --the-option Or use non-option subcommands: my-command subcommand --help Regards, -- Brandon McCaig <bamcc...@gmail.com> <bamcc...@castopulence.org> Castopulence Software <https://www.castopulence.org/> Blog <http://www.bamccaig.com/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.}; tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'
signature.asc
Description: Digital signature