note
robartes
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:
<code>
my $verbose='';
</code>
That's easy - $verbose becomes an empty scalar. This is also easy:
<code>
(my $verbose='');
</code>
This is an empty list (or better, a list containing that particular piece of emptiness referenced by $verbose.
<p>And here comes the hairy part:
<code>
\(my $verbose='');
</code>
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?
<p>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 :) ?
<p>CU<br>Robartes-
241367
241367