B
Bill M
What is the correct syntax for accessing a hash reference from a package?
For example:
Package MyPackage;
my $foo = {
animals => ["cat", "dog", "fish"],
people => ["fred", wilma" ]
};
1;
and then (this is what I THINK should work) ...
use MyPackage;
foreach my $animal (@{$MyPackage::$foo->{animals}}) {
print $animal;
}
Thanks!!!
For example:
Package MyPackage;
my $foo = {
animals => ["cat", "dog", "fish"],
people => ["fred", wilma" ]
};
1;
and then (this is what I THINK should work) ...
use MyPackage;
foreach my $animal (@{$MyPackage::$foo->{animals}}) {
print $animal;
}
Thanks!!!