In Perl, how can I import a hash from a library?
hash, perl, perl-module, scope
Solution
Create a proper module and change the my keyword to our:
# revs.pm
package revs;
our %vers = ( foo => "bar" );
1; # Perl modules need to return a boolean "true" value.
# importer.pl
use revs;
print $revs::vers{foo} . "\n";
Problem
I have a file `revs.pm`: ``` my %vers = ( foo => "bar" ); ``` And another file like `importer.pl`: ``` use revs; ``` How can I access `%vers` from `importer.pl` ?