in reply to Re: (tye)Re: our/my inconsistency.
in thread our/my inconsistency.
Strict means you must declare your variables with my(), our(), or 'use vars', or use fully qualified package names. Using our() or 'use vars' is just a way of saying we want a global variable but we don't want to have to use the fully qualified name all the time -- you do not have to declare globals that way if you do use fully qualified names (as you do in your sub).
Your example has two hashes: the global %main::hash (created on the fly in your subroutine) and the lexical %hash (declared near the top with the my() statement).
No warnings are produced by your sub because the main::hash is referenced twice (no 'used only once' warning), and the print() never executes because there are no keys to loop over (no 'unitialized' warnings).
|
|---|