in reply to Inspecting the name of a variable
From the manual entry for 'for':
Foreach Loops
The foreach loop iterates over a normal list value and sets the variable VAR to be each element of the list in turn. If the variable is preceded with the keyword my, then it is lexically scoped, and is therefore visible only within the loop. Otherwise, the variable is implicitly local to the loop and regains its former value upon exiting the loop. If the variable was previously declared with my, it uses that variable instead of the global one, but it's still localized to the loop. This implicit localization occurs only in a foreach loop
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Inspecting the name of a variable
by LanX (Saint) on Sep 01, 2012 at 20:18 UTC | |
by remiah (Hermit) on Sep 02, 2012 at 14:46 UTC | |
by LanX (Saint) on Sep 02, 2012 at 20:50 UTC | |
by remiah (Hermit) on Sep 03, 2012 at 01:18 UTC | |
by LanX (Saint) on Sep 03, 2012 at 09:09 UTC |
In Section
Seekers of Perl Wisdom