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?
In reply to Re^10: OUR declaration
by ikegami
in thread OUR declaration
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |