Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Welcome to the Monastery
 
PerlMonks  

Re^5: unitialized value in subroutine entry

by ikegami (Patriarch)
on Jun 27, 2006 at 11:52 UTC ( [id://557825]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re^4: unitialized value in subroutine entry
in thread unitialized value in subroutine entry

for some reason; perl doesn't complain about &$package::variable when this variable has not yet been declared!

Indeed

{ $var = 1; # ok. Strict off. } { use strict; $var = 1; # Error! } { use strict; $main::var = 1; # ok. Strict allows fully qualified var names. }

i was getting "faked out" by adding the package name to the code variable to silence the "requires explicit package name" message.

That message means your variable hasn't been declared. The text assumes most variables are package variables, but that's untrue. Lexical (my) variables should be used whenever possible.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://557825]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.