![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Using and renaming same variables/hash within different subroutinesby why_bird (Pilgrim) |
on Jun 24, 2009 at 08:26 UTC ( #774300=note: print w/replies, xml ) | Need Help?? |
...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_birdedit: added link Those are my principles. If you don't like them I have others. -- Groucho Marx .......
In Section
Seekers of Perl Wisdom
|
|