Reputation: 14490
use strict;
our %pre_pkg_configs;
$pre_pkg_configs{locDbList}={qw(default default_test)};
//load script A
my @locDbNames = ();
foreach my $dbName ($pre_pkg_configs{"locDbList"}){
print $dbName;
push(@locDbNames,$dbName);
}
HASH(0x119b368)
I was expecting values : default default_test
Upvotes: 0
Views: 79
Reputation: 943759
{ ... }
creates a reference to a hash (what you are calling an associative array).
If you print a reference, you get output like HASH(0x119b368)
It sounds like you want an array, so use an arrayref instead of a hashref:
$pre_pkg_configs{locDbList}=[ qw(default default_test) ];
Then, when printing it, you need to convert the arrayref into an array:
foreach my $dbName (@{$pre_pkg_configs{"locDbList"}}){
Upvotes: 5