$pack = getfilenamefromdb(); # The path or .pm is not part of the package name. require "pckg1/pckg2/$pack.pm"; no strict 'refs'; $result = ${"pckg1::pckg2::$pack\::"}{func}->();