perlfan99 has asked for the wisdom of the Perl Monks concerning the following question:
dear perlmonks,
i want to create a constant file and use it without the package name in other file. this is what i did,
it doesn't matter if i call "$const1" or "$MyConst::const1", same error as above, maybe i just don't understand Perl namespace, any help will be greatly appreciated.
Thanks!
i want to create a constant file and use it without the package name in other file. this is what i did,
///// MyConst.pm //////////// package MyConst; use Readonly; Readonly::Scalar $const1 => 1; ///////// END ////////////
i got this error: "Global symbol "$const1" requires explicit package name at MyConst.pm line 4////// test.pl ///////// use MyConst; print $const1; ////////// END //////////
it doesn't matter if i call "$const1" or "$MyConst::const1", same error as above, maybe i just don't understand Perl namespace, any help will be greatly appreciated.
Thanks!
Back to
Seekers of Perl Wisdom