http://qs321.pair.com?node_id=649191


in reply to How to declare globally visible subroutine like built-in ones ? Is it possible?

Are you sure you don't wan't use y; or require y; in z.pm?? This means that your depending on y.pm being loaded somewhere else, which is a pretty big trap for someone, yourself probably, debugging latter.

In any case, if you only want to use it from within package z, you could do this in y.pm

sub z::global_sub { print "global_sub working!"; }
If you don't like "G::global_sub", how about "::global_sub"? Think of '::' as a sigil (or twigil) for global. And as long as you use package declartions everywhere, you won't stomp on anyone elses namespace.