in reply to A curious case of of my()
It's quite simple: Using a my variable without having first executed the my is a bug. By braking that rule, you break the "fourth wall" between the promised behaviour of my and its optimised implementation.
my variables are created at compile time. Executing a my places a directive on the stack that will get executed on scope exit. The directive causes the variable to be cleared (if possible) or replaced (if a reference keeps it alive).
If you want a static variable, use state.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A curious case of of my()
by LanX (Saint) on Apr 05, 2011 at 16:09 UTC | |
by ikegami (Patriarch) on Apr 05, 2011 at 16:13 UTC | |
by LanX (Saint) on Apr 05, 2011 at 16:18 UTC | |
by ikegami (Patriarch) on Apr 05, 2011 at 18:11 UTC |