in reply to How do I determine the name of the calling script?
package Test; sub test { (caller)[1]; }; package main; print Test::test(); [download]
Originally posted as a Categorized Answer.