![]() |
|
Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Re: namespace crazinessby mkmcconn (Chaplain) |
on Jan 30, 2001 at 22:02 UTC ( [id://55292]=note: print w/replies, xml ) | Need Help?? |
Great catch, chipmunk! I see that it is a compile-time issue in the assignment of a value to the constant. Yet, in which namespace is that assignment to $x happening? It's not in "package First" - the $x in the BEGIN block is a global (note no need for use vars: readers could try testing for defined $First::x in the ternary to see what I mean. What fun! so, let's turn this into a compounded namespace+compile-time (follow the $x) problem, by re-writing the puzzle like this :
Update more good points, chipmunk. I think that each element is a red-herring: the special effects of use constant;, my(), and package in these snippets, all highlight how important it is to understand the context of what's happening in the program, where and when. Thanks for your help in thinking through the issues further. mkmcconn
In Section
Meditations
|
|