Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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

by tilly (Archbishop)
on Sep 28, 2000 at 17:04 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://34371]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-20 16:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found