in reply to Re^3: Can't localize lexical variable $var at...
in thread Can't localize lexical variable $var at...
You did not understood what I meant.
Those subs see that $var which is not seen outside that block, and perl doc says this is a trick to have private static variables.{ my $var=2; sub inc {return $var++} sub dec {return $var--} } print inc; print dec;
Courage, the Cowardly Dog.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Can't localize lexical variable $var at...
by Aristotle (Chancellor) on Jun 09, 2002 at 21:06 UTC | |
by Courage (Parson) on Jun 09, 2002 at 21:12 UTC |
In Section
Seekers of Perl Wisdom