in reply to Re^2: How to access multiple hash variables defined in a module (Exporter)
in thread How to access multiple hash variables defined in a module
Have you tried:
I see require Exporter; line is missed in your example.use strict; use warnings;
Update: Here's the working code:
package XYZ; use strict; use warnings; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(%Hash1); our ( %Hash1, %Hash2 ); sub populateHashRoutine { %Hash1 = ( a => 1, b => 2, ); %Hash2 = ( c => 3, d => 4, ); } 1;
use strict; use warnings; use Data::Dumper; use XYZ qw(%Hash1); XYZ::populateHashRoutine; warn Dumper \%Hash1, \%XYZ::Hash2; __END__ $VAR1 = { 'a' => 1, 'b' => 2 }; $VAR2 = { 'c' => 3, 'd' => 4 };
|
|---|