![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^3: scope and declaration in local packagesby ikegami (Patriarch) |
on Jan 31, 2011 at 15:40 UTC ( #885297=note: print w/replies, xml ) | Need Help?? |
So you think the function exists and the variable doesn't exist? That's not the case. The function and the variables are all declared at compile time. It's not complaining about the variables not existing. It's complaining that you didn't put a value in them, and that's because you didn't execute the assignment.
is the same as
Many language have a special declaration syntax that allows for the initialisation of variables, but Perl does not. my always initialise the variable it creates to undef* (scalars) or empty (arrays and hashes). If you want it to have another value, you need to assign a value to it. * — Implementation differs slightly, but you're not suppose to ever encounter that.
In Section
Seekers of Perl Wisdom
|
|