P is for Practical | |
PerlMonks |
Re: Re: GetOpt::Long usage styleby demerphq (Chancellor) |
on Mar 08, 2003 at 12:32 UTC ( [id://241374]=note: print w/replies, xml ) | Need Help?? |
\(my $verbose=''); my returns what has been declared. (Although the behaviour of it as a function is a little interesting, I dont think it can be prototyped, and I can't find complete documentation for it off hand.) The parenthesis required because the precedence of the assignment operator causes
to be parsed something like
which is a syntax error. They aren't required when the variable isn't initialized as part of the my. Also I personally think that they add visual calrity when the reference to the variable is taken. Since the my returns the variable declared (as an lvalue) we can take a reference to it with \. The reference operator \ can technically go inside the parens or outside in this case as
is shorthand for
Hope that clarifys things. ;-) Er, and yes. You analysed it correctly. :-) A couple of related tricks are:
--- demerphq
In Section
Meditations
|
|