P is for Practical | |
PerlMonks |
Re^4: Use of uninitialised value... but it is defined ?!by dave_the_m (Monsignor) |
on Mar 02, 2016 at 08:37 UTC ( [id://1156628]=note: print w/replies, xml ) | Need Help?? |
'my' has a compile-time and run-time action. The compile-time action is to place a new undef SV in the pad of the sub currently being compiled. This var is immediately available to be closed over when compiling any following subs or BEGIN blocks within the same scope.
At run time it pushes the current SV in the pad onto the args stack, and adds a note to free the SV on scope exit (and replace with a fresh new one). An assignment, such as ..=1 happens at run time of course. Dave.
In Section
Seekers of Perl Wisdom
|
|