This is the first time, I am working with module. I am trying to retrieve the content of a hash present in the module into main perl code.
Below is the module DRUG.pm
package DRUG;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(%DRUG);
%DRUG = (
'warfarin ' => 1,
'midazolam ' => 1,
'acebutolol ' => 1,
);
Here is the main program, trying to access hash present in the module
use warnings;
use strict;
use DRUG;
foreach my $nme (keys %DRUG){
print "$nme\n";
}
I am unable to get hash information from module and could not print that hash in the main perl code.
Can some one help me in this?
THanks
Shouldn’t
be
And you need a
1;at the end of the DRUGS.pm