in reply to modules as data files
There is little difficulty, if you first think for the simple solution: call it with do() from ::main, and fetch as the return value the hash itself. At least the do() statement will in fact fetch something each and every time it is called,
but require() will only fetch it once only
####### Inside "test0.pm" ############################### return $data = { k0 => 'apple' , k1 => 'orange', }; ###### Inside the main program: ############################### use strict; use warnings; my $pmfile = shift @ARGV; my $pm = do "$pmfile" or die
In Section
Seekers of Perl Wisdom