Re: State variables

* Torsten Schoenfeld <kaffeetisch gmx de> [2006-05-04 19:05]:
If you put a block around a sub, you can declare a lexical
variable in that scope but outside the sub.  It will then
behave like a state variable:

Is that really exactly what state variables do? So far, all
explanations about what state variables in Perl 6 are for have
left me confused. I assumed they work the way you outlined, but
all descriptions Iâve seen make them sound much more subtle and
hard to grasp.

Is that really all?

*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]