#! perl use strict; use warnings; package Foo; sub f { my ($package, $filename, $line) = caller; printf "Function '%s::f()' called from package '%s'\n", __PACKAGE__, $package; } package Bar; Foo::f(); #### 22:24 >perl 1686_SoPW.pl Function 'Foo::f()' called from package 'Bar' 22:24 >