Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re (tilly) 1: Scoped Variables in a Recursive Function.

by tilly (Archbishop)
on Sep 28, 2000 at 17:04 UTC ( #34371=note: print w/ replies, xml ) Need Help??


in reply to Scoped Variables in a Recursive Function.

For my attempt once at explaining the error, take a look at RE (3): BrainPain-Help.

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.


Comment on Re (tilly) 1: Scoped Variables in a Recursive Function.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://34371]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (11)
As of 2014-09-22 17:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls