in reply to Getting Getopt::Long values into a hash

Note though that when you refer to $my_hash->{huose} later in your code, you will not be alerted about the typo, rather your code will fail silently but keep running. If this typo was in a variable name, such as $opt_huose, you’d get a loud complaint from strict about using an undeclared variable.

So I advise against putting options in a hash. Instead, I recommend demerphq’s proposed GetOpt::Long usage style – which is how I write my commandline utilities now.

Makeshifts last the longest.

  • Comment on Re: Getting Getopt::Long values into a hash