for Ex :
package test1 ;
my %hash = ( a=> 10 , b => 30 ) ;
1;
in Script :
use test1 ;
print %hash ; # How to make this avilable in script without sub
for Ex : package test1 ; my %hash = ( a=> 10 , b
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Good programming practice prescribes that you do not allow foreign code to mess with a module’s data directly, instead they must go through an intermediary, for example an accessor routine.
TIMTOWTDI, with and without exporting. The Moose example appears quite long, but this one also allows setting data as opposed to just reading it from
Test1, where the other three examples would need quite some additional code to handle this case.unsugared
Module
Program
Moose
Module
Program
Sub::Exporter
Module
Program
Exporter
Module
Program