in reply to Package Variables
Consider using Exporter
package MyConfig; use Exporter 'import'; @EXPORT = qw(); @EXPORT_OK = qw(%amazon_config); use strict; our %amazon_config = ( 'name' => 'amazon', 'host' => 'localhost', 'user' => 'amazon', 'pass' => 'somepass', 'upload_path' => '/', 'file_types' => [ qw( jpg mobi ) ], ); 1; __END__
And your script:
#!/usr/bin/perl use MyConfig qw(%amazon_config); use strict; use warnings; print "Host: ",$amazon_config{host},"\n"; print "Name: ",$amazon_config{name},"\n";
Output
- MillerHost: localhost Name: amazon
|
|---|