in reply to Re^9: OUR declaration
in thread OUR declaration
Who said anything about making $q a global? It already was. I'm saying he might have wanted it to keep on being a global. When fixing someone else's code, I try to follow the "minimal change" doctrine. If it's a global, leave it a global. Especially since it's proper for this variable to be a global, given how it's used for input, processing and output.
I'm still confused why you say "Lexical variables don't retain values when they go out of scope". It's true, but it's meaningless here. Both lexical variables and localized package variables lose their values at the end of their scope. Both global lexical variables and global package variables have the same scope. Replacing my $q with local our $q would give $q neither a larger scope nor a greater persistance. Do you think otherwise?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^11: OUR declaration
by perrin (Chancellor) on Sep 25, 2006 at 17:49 UTC |