in reply to dbmopen mistake?
my %uberhash=(1,2,3,4); sub a { my %hash=(1,2,3,4); } sub b { #can see %uberhash #can't see %hash }
%hash is not seen anywhere but in sub a because 'my' creates variables local to a block (and a subroutine aka function creates a block. Remedies: You could create the variable with 'our' instead of 'my' making the variable globally accessible, or add something like 'my %hash;' outside of the subroutine.
Another possibility would be to return the hash contents as function result and assign that to a globally accessible variable
|
|---|