my $subname = "package::sub"; if (my $coderef = main->can($subname)) { $coderef->(@args); }