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


in reply to scoping problems

If you have syntax errors and errors about undeclared variables, fix the syntax errors first. Sometimes the errors about undeclared variables are caused by mis-parses which again come from the syntax errors, so they go away once you fix the syntax errors. (Sometimes, not always).