http://www.perlmonks.org?node_id=541424

secret has asked for the wisdom of the Perl Monks concerning the following question:

Hello esteemed Monks,

I have the following pm file :

use strict ; use warnings ; package FOO ; sub Principal::bof { my $fic = "toto" ; bof2() ; } sub bof2 { print $fic } 1;
Which is loaded by a script like this :
use strict ; use warnings ; package Principal ; require ("ot.pm") ; Principal::bof() ;
This fails with  Global symbol "$fic" requires explicit package name .

I tried to do print $FOO:fic or print $Principal::fic in the bof2 sub but then it fails with Use of uninitialized value in print

I don't understand the namespaces relations in this . Is there a way i can access the value from bof2() without passing it as parameter ?

Thanks if you can help .