in reply to Re^3: A curious case of of my()
in thread A curious case of of my()
So this variable is a lexical which just isn't resetted in further runs, because of the if condition, (such that the old value of previous runs remains in the assigned memory-slot)
One might argue what a global variable is, in Perl context it's normally used as synonym for package variables.
Actually I'm trying to avoid the term "global" and prefer saying "package" or "lexical"! (There are hacks to globally manipulate lexicals)
IMHO the only acceptable least misunderstandable use of the term "global" is with special vars like $_ which always belong to main:: without full qualification, no matter which package you're in.
$_=666; package Foo; print $_; # -> 666
HTH! :)
Cheers Rolf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: A curious case of of my() (What is GLOBAL?)
by Eliya (Vicar) on Apr 05, 2011 at 12:46 UTC | |
by LanX (Saint) on Apr 05, 2011 at 12:52 UTC | |
by JavaFan (Canon) on Apr 05, 2011 at 13:46 UTC | |
by LanX (Saint) on Apr 05, 2011 at 14:09 UTC | |
by ikegami (Patriarch) on Apr 05, 2011 at 18:23 UTC | |
|
Re^5: A curious case of of my()
by anonymized user 468275 (Curate) on Apr 05, 2011 at 12:39 UTC | |
by LanX (Saint) on Apr 05, 2011 at 12:48 UTC | |
by JavaFan (Canon) on Apr 05, 2011 at 12:43 UTC | |
| |
by LanX (Saint) on Apr 05, 2011 at 12:49 UTC |