Is there a tool for extracting all variable, module, and function names from a Perl module file?

My apologies if this is a duplicate; I may not know the proper
terms to search for.

I am tasked with analyzing a Perl
module file (.pm) that is a fragment of a larger application. Is there
a tool, app, or script that will simply go through the code and pull
out all the variable names, module names, and function calls? Even
better would be something that would identify whether it was declared
within this file or is something external.

Does such a
tool exist? I only get the one file, so this isn't something I can
execute -- just some basic static analysis I guess.

Related to : Is there a tool for extracting all variable, module, and function names from a Perl module file?

My apologies if this is a duplicate; I may not know the proper
terms to search for.

I am tasked with analyzing a Perl
module file (.pm) that is a fragment of a larger application. Is there
a tool, app, or script that will simply go through the code and pull
out all the variable names, module names, and function calls? Even
better would be something that would identify whether it was declared
within this file or is something external.

Does such a
tool exist? I only get the one file, so this isn't something I can
execute -- just some basic static analysis I guess.

I have a variable in my main module which is changed using another
module, but I want to change the variable from my main module through
another module. I'm new to programmering, so I actually don't really
know how to explain this stuff - sorry if I'm asking a stupid
question.

The program's hierarchy looks a bit like
this:

Main

---Features

---Pygame_handling

------Features

I use the
"Features" module to change a variable in the "Main". I do this simply
by getting the defined variable from "Features". But when I change the
variable through "Pygame_handling", it is not changed in the
"Features" object

I'd like to define a helper function that has the ability to modify
a module-level variable (with known name) from surrounding context
without explicitly passing it, e.g.

# mod1.pymod_var = 1modify_var()# mod_var modifiedprint
mod_var

The problem is - I can't reference
variable by mod1.mod_var, because I want to use helper
function across many modules (helper itself will be defined in other
module); it should dynamically 'pick' mod_var from surrounding calling
context/scope.