I am new to this site, so bear with me if this question has already been answered elsewhere. I try to call the subroutine "bar" from the module "codons1.pm", and I encounter the error: Can't find the method of the object "bar" through the package "codons1.pm" (maybe you forgot to download "codons1.pm"?). The main script is as follows:
use strict;
use warnings;
my $i = 1;
my $pack = "codons$i\.pm";
require $pack;
(my %temp) = $pack->bar();
print keys %INC ;
Thanks ( Perl Object Error: Unable to find object method via package ), I was able to verify using% INC that the module was loaded. The module is as follows:
package codons1;
sub bar{
return (%some_hash);}
1;
I use $ i so that I can load several similar modules through a loop. Any suggestions are welcome and very grateful in advance.