in reply to GetOpt::Long usage style
Purely from a code clarity and locality point, this is better. It is however a bit difficult to figure out why it works (anything but blindingly obvious, at least to me). Let me try to figure it out for my own good - correct me if I'm wrong:
That's easy - $verbose becomes an empty scalar. This is also easy:my $verbose='';
This is an empty list (or better, a list containing that particular piece of emptiness referenced by $verbose.(my $verbose='');
And here comes the hairy part:
This is a reference to that particular piece of emptiness pointed to by $verbose, hence in a sense (though strictly speaking not) a reference to $verbose. We're basically pointing to the same scalar thingy as $verbose is pointing to, so when GetOpt::Long uses this reference to stash the option value, we can use $verbose to get at that value. Correct?\(my $verbose='');
That is a very neat trick, sir! Despite the minor headache in figuring it out (for me anyway), I think I shall be using it from now on. Perhaps you need to figure out a catchy name for it :) ?
CU
Robartes-
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: GetOpt::Long usage style
by demerphq (Chancellor) on Mar 08, 2003 at 12:32 UTC | |
by OneTrueDabe (Acolyte) on May 08, 2014 at 16:00 UTC | |
by tye (Sage) on May 09, 2014 at 00:37 UTC | |
by demerphq (Chancellor) on Apr 11, 2016 at 17:22 UTC | |
Re: GetOpt::Long usage style
by Abigail-II (Bishop) on Mar 08, 2003 at 23:00 UTC | |
by robartes (Priest) on Mar 08, 2003 at 23:22 UTC | |
Re: Re: GetOpt::Long usage style
by zby (Vicar) on Mar 08, 2003 at 17:04 UTC |
In Section
Meditations