Assuming you had a script configuration variable that was used numerous
places in your script, further assume that you have "use strict;" in
your perl script.
You could declare the variable "my" and pass that variable to any
subroutines that needed it with @_.
Or you could declare that variable with "local" or some other "scope
defining declaration" so that it would be available automatically in any
and all subroutines called from the level you declared the var as "local"
My question concerns a little of form and a little of function
On the function front:
which approach is faster? With one you need a
my ($arg1, $arg2...) = @_;
inside each subroutine which should take some time to execute.
(I apologize if the syntax isn't correct for the above line, I don't
have my notes available and I'm questioning the use of the parenthesis,
but you should be able to get the idea, which is all I'm after)
On the form front, Ive noticed that the scripts are not as readable for
me, and by extension probably any other people who use my script.
What are your thoughts on choosing which approach to take? I'm sure
both are technically correct, but I'm sure there are places where one
approach should be preferred over the other.
--
Rance Hall
System Administrator
Nebraska Turkey Growers
1-308-468-5711, ext. 106
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>