I want to export multiple hashes and its not working, I can retrieve one(often not the one I want either) but not the other.

Overview: - The perl module reads a directory of files and their contents and creates multiple hashes in different ways for different purposes. The perl file should be able to get both hashes. I've played around with Exporter with no luck. (Note: I've got the hashes declared within the subroutine and outside of it as well, not sure where it should be declared with how I'm calling it. Here's what I've got:

Did you make ALL of the changes that FishMonger suggested? If so, your only error is forgetting to dereference your hash reference $searchadmin_id in your print statement.

You seem to be confusing the concept of argument with that of IMPORT/EXPORT. I suggest that you implement the subroutine Read_Active as a subroutine in main. After you have it working, move it to a module if you still want to. This approach will separate the two issues. Good Luck, Bill

So, assuming your main program has a line calling your module like this:

Code

my ($search_href, $record_href) = Read_Active();

what you get is a pair of references to hashes, not the hashes themselves, so you need to deference $search_href in order to fetch the content of the %searchadmin_id hash populated in the Read_Active function of your module. This could be done this way:

Code

print "$search_href->{req} \n";

or:

Code

print "$$search_href{req} \n";

If you do not understand this or if it still does not work, then please post the code of your module modified along the lines suggested by FishMonger as well as the code of the calling program.