Just have a look at perldoc -f caller
In reply to Re: Determine if sub is called from control block. by lordsuess in thread Determine if sub is called from control block. by shotgunefx