http://www.perlmonks.org?node_id=931947


in reply to Variable declaration

In addition to the other comments, I recommend new programmers also use diagnostics. Not only does that give you more information about the error, it also gives you suggestions on how to fix it. Here's the output I get when I include that:

Global symbol "$another_variable" requires explicit package name at di +ag.pl line 6. Execution of diag.pl aborted due to compilation errors (#1) (F) You've said "use strict" or "use strict vars", which indicates + that all variables must either be lexically scoped (using "my" or +"state"), declared beforehand using "our", or explicitly qualified to say which package the global variable is in (using "::"). Uncaught exception from user code: Global symbol "$another_variable" requires explicit package na +me at diag.pl line 6. Execution of diag.pl aborted due to compilation errors. at diag.pl line 6