in reply to Who called Perl?

You can use getppid resp. Win32::Getppid to find the PID of the parent process. This is not necessarily a shell, because Perl and other programs can also launch Perl directly without an intervening shell.