I would suggest you to pick some book or tutorial to go through it first. See what all is already there and how they can be used. This would help you know basic stuff.
For now, above query, look details here:
Using variable from modules[
^]
Quote:
We can also use variables from different packages. But we need to declare them first before using them. We do this by use vars qw($scalar @array %hash) and we can also use our ($scalar @array %hash) with Perl v5.6.0 or higher versions.
Example:
use strict;
use warnings;
package b;
our ($var_name);
sub Hello{
print "Hello $var_name\n";
}
1;
use strict;
use warnings;
use p;
$p::var_name = "Sam";
p::Hello();
Output:
Hello Sam