Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Using and renaming same variables/hash within different subroutines

by why_bird (Pilgrim)
on Jun 24, 2009 at 08:26 UTC ( [id://774300]=note: print w/replies, xml ) Need Help??


in reply to Using and renaming same variables/hash within different subroutines

...so that it won’t collide with same variable within another subroutine...
There shouldn't be any collision, if you 'my' something within a subroutine, that variable should be scoped only to the end of that block (i.e. to the end of the subroutine). So you can call two variables in two different subroutines the same thing.

Look here for a good explanation of 'lexical scoping' (i.e. declaring variables with 'my')

why_bird
edit: added link
........
Those are my principles. If you don't like them I have others.
-- Groucho Marx
.......
  • Comment on Re: Using and renaming same variables/hash within different subroutines

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-19 12:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found