in reply to Re^5: Dual personality: Module and script
in thread Dual personality: Module and script

I actually was ahead of you and changed to "caller" right after I tried $0, albeit it worked for me, and I was not insisting on robust solution for any and all Perl/OS/hardware combinations.

It came as simple as adding the short standalone subroutine and one line of testing :)
standalone() if (!defined caller); # command-line or "system"