Purl Gurl said:
%TAGS is global. This is most obvious, even to newbies.
No it isn't. Despite your claims otherwise.
Readers would benefit by your discussing why you, personally, prefer
certain syntax over others.
It isn't the syntax, it is the semantics.
Readers will also benefit by your discussing
when you "can't" per your statement.
When the variable is a built-in variable.
When you want a global variable. (ie. one that is visible in another
source code file)
When you are doing guru-level mucking about with the symbol table.
You have a habit of stating what
readers can and cannot do, but rarely offer reason why.
If they read the article I referenced, they would get all that.
Not much point in restating it when it has already been stated elsewhere.
Is it your
intent to dictate or to teach?
To teach, obviously, that is why I included a link that teaches
the difference.
Your "file-scoped" expression, is not that a semantic lie for "global" variable?
It depends on if the program is in in single file or not.
We did not see the OP's complete program so we cannot know which it is.
What factual basis do you have for your statement?
Because you said that my() is a global variable and it is not.
A global variable can be accessed from *anywhere*.
A lexical variable can NOT be accessed from a different file,
so it is not global.
Don't need to be, you clearly think that file-scoped is the same
as "global" when it isn't.
Your falling back upon personal insult is a rather lame tactic employed
I did not insult you.
I said that you did not understand the difference between lexical
variables and package variables. And you don't!
by those seeking to cover for a lack of knowledge, a tactic used by trolls.
You espoused your lack of knowledge authoritatively and I didn't want
any other readers to be taken in by your lack of understanding.
No insult there, just an obvious fact.
End result is you are displaying a lack of knowledge and experience,
No, it is you displaying the lack. (and me offering you a chance
to un-lack
with your classic display of a lack of self-confidence.
Because I know what I am talking about and you don't.
This is typical of
many long time posters here; an effort to conceal problems with Perl rather
than share knowledge about problems and how to deal with problems.
Why don't you just learn the difference so that you *will* be
qualified to instruct others in the difference?
If a purpose is served by lexical declaration of global variables, it is to
compensate for broken code within the strict module,
Even a freshman CS student knows that global variables are "bad".
They lead to "action at a distance", a very hard-to-troubleshoot
class of errors.
Restricting the scope of a variable has been a common practice by
real programmers for decades, please catch up.
I am curious how you read my mind, how you know my extent of knowledge.
I didn't read your mind, I read your post.
Your post displayed that the extent of your knowledge was limited,
I provided a means for you to overcome that limitation.
Whether you choose to do that, or to remain in ignorance is up to you,
but I'm not going to let you lead others off into the woods...