in reply to GLOBAL VARIABLE HANDLING

You never call mypkg->new(). Why do you expect initialization to happen if you never call it?

If you want the initialization to always happen automatically, call mypkg->new() from within mypkg:

package mypkg; use strict; sub new { ... }; ... mypkg->new(); 1;

Replies are listed 'Best First'.
Re^2: GLOBAL VARIABLE HANDLING
by kaushal_k1 (Novice) on Jul 26, 2011 at 15:03 UTC
    In pkg B instead of what i have written if i wrap that "get" call inside a function it works fine. I think there is more to it related to compile time and runtime calls which I am trying to understand.