in reply to Scoped Variables in a Recursive Function.
It really is a naming issue.
Functions are given global names from which you can reach them from anywhere, any time. But only one can be available from that name at a time anywhere in the program.
Lexical variables (declared with my) are private names that can only be reached by name from certain blocks of executing code. There may be several copies of a given lexical variable in existence at the same time, but because of how the naming works, they won't be mixed up.
Now Perl is being asked to figure out which copy of a lexical variable will be seen when you call the globally named function and is throwing its hands up in disgust.
|
|---|