sub definitions are parsed once only. The closure retains the value it had at that point in time.
Yes, subs are only parsed once, but that's irrelevant.
The capturing occurs when the code ref is created. That's when the sub is defined for named subs, and that's when the sub op is executed for anonymous subs.
Furthermore, closures capture variables, not values. The value of the variable can be changed, from both inside and outside the sub.
In reply to Re^2: closure clarity, please
by ikegami
in thread closure clarity, please
by 7stud
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |