Global symbol requires explicit package name will only be displayed when your scipt is configured to use warnings.
use warnings;
Global symbol requires explicit package name will be returned when attempting to use a lexical variable outside of the scope that the lexical variable was defined in. Refer to Global and Lexical variable in Perl to understand and resolve this error.